I am working on a simple rails-based volunteer management system. I would like to use Google calendar to render the scheduling information. To this end I am using the icalendar gem to generate a calendar from a list of shifts:
def generate_ical
cal = Icalendar::Calendar.new
@shifts.each do |shift|
event = Icalendar::Event.new
event.start = shift.start.strftime("%Y%m%dT%H%M%S")
event.end = shift.end.strftime("%Y%m%dT%H%M%S")
event.summary = shift.task.name if shift.task
event.uid = shift_url(shift)
cal.add event
end
cal.to_ical
end
This generates an output like this:
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:iCalendar-Ruby
BEGIN:VEVENT
DTEND:20131122T230000
DTSTAMP:20131125T003944
DTSTART:20131122T220000
SEQUENCE:0
SUMMARY:Server
UID:http://vols.herokuapp.com/shifts/980190962
END:VEVENT
END:VCALENDAR
When I use that output as the import for a Google calendar, it shows no events. It checks correctly against a validator.
If I create a calendar with a test event in Google calendar, the ical for it looks like:
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:Test Calendar
X-WR-TIMEZONE:America/New_York
X-WR-CALDESC:
BEGIN:VFREEBUSY
DTSTART:20131122T150000Z
DTEND:20131122T160000Z
DTSTAMP:20131124T221822Z
UID:[email protected]
ATTENDEE;X-NUM-GUESTS=0:mailto:[email protected]
SUMMARY:Busy
END:VFREEBUSY
END:VCALENDAR
It uses a different block name: VFREEBUSY instead of VEVENT. I've found references online to VEVENTs in Google calendars, so that probably isn't the issue. Does anyone have experience with connecting this gem to Google calendar who can point me to what I need to change?