geekdeepak / gdata-ruby-util

Automatically exported from code.google.com/p/gdata-ruby-util
Apache License 2.0
0 stars 0 forks source link

Handle Google Calendar 302 API responses gracefully #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Calendar Data API

What steps will reproduce the problem?

1. client = GData::Client::Calendar.new
2.
client.get("http://www.google.com/calendar/feeds/default/allcalendars/full").to_
xml

I expect to see some xml describing my calendars. However, the google
Calendar API suggests that i may be redirected (302) and the redirect
response will include a new url with a gsessionid parameter. 

Unfortunately, gdata/client/base.rb make_request method will raise an
exception when 302 is returned. 

I was able to move around this by having the method return the response in
stead of raising an exception. I think that this should be the default
behavior. The programmer should be able to handle HTTP responses. Not the
Library. 

Original issue reported on code.google.com by this.rya...@gmail.com on 5 Mar 2009 at 10:36

GoogleCodeExporter commented 9 years ago
Thanks for adding 302 as a success. But perhaps we could let the client program
decide the outcome of a new request. Can I take a stab at working with this
particular method? 

Original comment by this.rya...@gmail.com on 5 Mar 2009 at 10:37

GoogleCodeExporter commented 9 years ago
I'm debating about this. Giving control to the programmer is cool, but I 
imagine a
lot of code is 

# try to do API operation

# catch possible API failures and inform user / redo

It seems annoying to make the developer check after each call if there was an
authentication problem instead of just catching one exception. 

I'm open to ideas though. Since this is getting conversational you can just 
e-mail me
directly.

Original comment by jfis...@youtube.com on 5 Mar 2009 at 10:46

GoogleCodeExporter commented 9 years ago
For tracking purposes r19 made 302 a success.

Original comment by jfis...@youtube.com on 5 Mar 2009 at 10:47

GoogleCodeExporter commented 9 years ago
This issue (Calendar Redirects) has been resolved in trunk as of r20.

Original comment by jfis...@youtube.com on 6 Mar 2009 at 12:35