Having problems interfacing with Google Calendar API using Net::HTTP

've been attempting to work on a script that would synch my iCal
calendar with my google calendar. Just in an attempt to get the hang of
the api, I'm trying to generate an event and then add it. I've got the
xml generated just fine, but when I try to authenticate myself with
google. I get an error. Does anyone have any ideas?

Google Calendar "Add Event":

My code:
res =
Net::HTTP.post_form(URI.parse("https://www.google.com/accounts/ClientLogin"),

                          {'Email' => "myemail", 'Passwd' =>
"mypassword",
                           'source' =>
"blissdevelopment-calendarSync-1", 'service' => "c1"})

puts res.body

And then the error:
/opt/local/lib/ruby/1.8/net/protocol.rb:133:in `sysread': Connection
reset by peer (Errno::ECONNRESET)
        from /opt/local/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill'
        from /opt/local/lib/ruby/1.8/timeout.rb:56:in `timeout'
        from /opt/local/lib/ruby/1.8/timeout.rb:76:in `timeout'
        from /opt/local/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'
        from /opt/local/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
        from /opt/local/lib/ruby/1.8/net/protocol.rb:126:in `readline'
        from /opt/local/lib/ruby/1.8/net/http.rb:1988:in
`read_status_line'
        from /opt/local/lib/ruby/1.8/net/http.rb:1977:in `read_new'
        from /opt/local/lib/ruby/1.8/net/http.rb:1046:in `request'
        from /opt/local/lib/ruby/1.8/net/http.rb:405:in `post_form'
        from /opt/local/lib/ruby/1.8/net/http.rb:545:in `start'
        from /opt/local/lib/ruby/1.8/net/http.rb:404:in `post_form'
        from calendar_sync.rb:32

I would suggest looking at WWW::Mechanize,
http://mechanize.rubyforge.org/\. Also, if you use iCal as your main
interface, you don't really need to write any code, Google speaks ical
(little i) and iCal can import this data.

···

On Mon, Sep 11, 2006 at 02:20:29PM +0900, blissdev wrote:

've been attempting to work on a script that would synch my iCal
calendar with my google calendar. Just in an attempt to get the hang of
the api, I'm trying to generate an event and then add it. I've got the
xml generated just fine, but when I try to authenticate myself with
google. I get an error. Does anyone have any ideas?

Google Calendar "Add Event":
Google Calendar  |  Google for Developers

My code:
[snipped]