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

B

blissdev

'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":
http://code.google.com/apis/gdata/calendar.html#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
 
L

Logan Capaldo

'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":
http://code.google.com/apis/gdata/calendar.html#add_event

My code:
[snipped]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top