Hi all, I'm trying to programmatically sign up a user to a calendar in
a ruby on rails app.
Here's my code:
def add_calendar_subscription(calendar_id)
begin
srv = GoogleCalendar::Service.new(@email, @password)
calendar_id = "c4o4i7m2lbamc4k26sc2vokh5g
%40group.calendar.google.com"
target_url = 'www.google.com'
path = '/calendar/feeds/default/allcalendars/full'
http = Net::HTTP.new(target_url)
xml_request = "<?xml version='1.0'?>
<entry xmlns='http://www.w3.org/2005/Atom'>
<id>#{calendar_id}</id>
</entry>"
xml_response = http.post(path, xml_request)
puts xml_response.body
rescue GoogleCalendar::AuthenticationFailed
RAILS_DEFAULT_LOGGER.warn "[EMAIL PROTECTED] authentication failure
for
Google Cal"
end
end
I get an error: #<Net::HTTPUnsupportedMediaType 415 Unsupported Media
Type readbody=true>
when trying to set the xml_response variable.
Is my XML correct? I can't find any information on how it should look
other than
http://code.google.com/apis/calendar/developers_guide_protocol.html#AddingSubscriptions
which I used as a model for mine.
Any help would be greatly appreciated!
Mark
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---