Hello everyone
Does anyone have any experience of accessing the Google Calendar API
with Rails?
I''m using Ben''s page as a starting point.
http://benjamin.francisoud.googlepages.com/googlecalendar
I''ve installed the libraries but I can get data, I can add data, good
start.
I''m now starting to use the get_calendars method of the gdata class
and I''m having problems.
Namely, this bit of code
require ''googlecalendar''
g = GData.new
g.login(''REPLACE_WITH_YOUR_MAIL-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org'',
''REPLACE_WITH_YOUR_PASSWORD'')
calendar_list = g.get_calendars()
print calendar_list
Now I''m getting back a 200 OK message object back, I thought
I''d be
getting an array of calendars I''m a member of.
Has anyone been down this track?
Any information would be helpful and I''ll gladly share my experience
of setting this up with anyone else.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
A bit more information, if I output this instead I can see exactly
what I''m getting back.
print calendar_list.inspect
This gives me back
#<Net::HTTPOK 200 OK readbody=true>
calendar_list.each { |key, value| print key + '' = '' + value +
"\n" }
gives me back
<Net::HTTPOK 200 OK readbody=true>last-modified = Thu, 10 Apr 2008
11:32:57 GMT
cache-control = max-age=0, must-revalidate, private
connection = Close
date = Thu, 10 Apr 2008 11:32:57 GMT
content-type = application/atom+xml; charset=UTF-8
server = GFE/1.3
transfer-encoding = chunked
I''m starting to think that the get_calendars method is not doing what
it describes itself doing in it''s own logic here
http://pastie.caboo.se/178486
Although it''s much more likely a syntaxical errror on my behalf :-)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Hi, I would recommend trying to invoke the following code in the console:
require ''googlecalendar''
g = GData.new
g.login(''REPLACE_WITH_YOUR_MAIL-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org'',
''REPLACE_WITH_YOUR_PASSWORD'')
calendar_list = g.get_calendars()
print calendar_list
Good luck,
-Conrad
On Thu, Apr 10, 2008 at 4:37 AM, vanderkerkoff
<tonmatt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> A bit more information, if I output this instead I can see exactly
> what I''m getting back.
>
> print calendar_list.inspect
>
> This gives me back
>
> #<Net::HTTPOK 200 OK readbody=true>
>
> calendar_list.each { |key, value| print key + '' = '' +
value + "\n" }
>
> gives me back
>
> <Net::HTTPOK 200 OK readbody=true>last-modified = Thu, 10 Apr 2008
> 11:32:57 GMT
> cache-control = max-age=0, must-revalidate, private
> connection = Close
> date = Thu, 10 Apr 2008 11:32:57 GMT
> content-type = application/atom+xml; charset=UTF-8
> server = GFE/1.3
> transfer-encoding = chunked
>
> I''m starting to think that the get_calendars method is not doing
what
> it describes itself doing in it''s own logic here
>
> http://pastie.caboo.se/178486
>
> Although it''s much more likely a syntaxical errror on my behalf
:-)
>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Hi Conrad, thanks for getting back to me. The code you suggested I try is exactly the same code that I pasted into the ticket initially :-) I found the problem. In the get_calendars() method the redirect_response was being returned, not the redirect_data. Changing that line to return redirect_data gives me exactly what I was looking for, a list of calendars that I have access to. Thanks anyway Conrad. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ahh Don''t listen to me There''s nothing wrong with the redirect_response line, I wasn''t using the right syntax to get at the data. print calendar_list.body That''s the puppy. On Apr 10, 1:44 pm, vanderkerkoff <tonm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Conrad, thanks for getting back to me. > > The code you suggested I try is exactly the same code that I pasted > into the ticket initially :-) > > I found the problem. > > In the get_calendars() method the redirect_response was being > returned, not the redirect_data. > > Changing that line to return redirect_data gives me exactly what I was > looking for, a list of calendars that I have access to. > > Thanks anyway Conrad.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Worked it out in the end.
Here''s how you access your GData get_calendars() data and strip out
the ID of each entry(calendar) and the name of each entry and create a
hash out of the data to use somewhere else.
require ''hpricot''
require ''googlecalendar''
k = GData.new
k.login(''youraddress-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org'',
''yourpassword'')
bcalendar_list = k.get_calendars()
calendar_list = bcalendar_list.body
doc = Hpricot(bcalendar_list.body.to_s)
@cal_names = Hash.new
(doc/:entry).each do |item|
@cal_names[item/:id] = item/:name
end
On Apr 15, 8:38 am, vanderkerkoff
<tonm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Ahh
>
> Don''t listen to me
>
> There''s nothing wrong with the redirect_response line, I
wasn''t using
> the right syntax to get at the data.
>
> print calendar_list.body
>
> That''s the puppy.
>
> On Apr 10, 1:44
pm,vanderkerkoff<tonm...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > Hi Conrad, thanks for getting back to me.
>
> > The code you suggested I try is exactly the same code that I pasted
> > into the ticket initially :-)
>
> > I found the problem.
>
> > In the get_calendars() method the redirect_response was being
> > returned, not the redirect_data.
>
> > Changing that line to return redirect_data gives me exactly what I was
> > looking for, a list of calendars that I have access to.
>
> > Thanks anyway Conrad.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---