[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

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

blissdev

9/11/2006 5:18:00 AM

'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...

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

{'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

1 Answer

Logan Capaldo

9/11/2006 3:03:00 PM

0

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":
> http://code.google.com/apis/gdata/calendar.html...
>
> My code:
> [snipped]

I would suggest looking at WWW::Mechanize,
http://mechanize.ruby.... 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.