I’m trying to use gcal4ruby to add an event to a google calendar. When I run my code, I get this error:
undefined method `start=' for #<GCal4Ruby::Event:0x00000102bb47b8>
Here’s my code:
service = GCal4Ruby::Service.new
service.authenticate("username", "password")
cal = GCal4Ruby::Calendar.find(service, "calendarname", :first)
event = GCal4Ruby::Event.new(cal)
event.title = "Soccer Game"
event.start = Time.parse("12-06-2009 at 12:30 PM")
event.end = Time.parse("12-06-2009 at 1:30 PM")
event.where = "Merry Playfields"
event.save
The error occurs on the line “event.start = …”
This is confusing me because this code is literally copied from the documentation.
EDIT: After opening up the actual .rb files of the plugin, it turns out the documentation is simply wrong. the methods event.start and event.end should be event.start_time and event.end_time. But now I’m getting this error:
undefined method `editable' for nil:NilClass
At the “event.save” line. Anyone work with this plugin and have a clue? Or can suggest a library for working with google calendar that has better documentation? 😉
Try changing the event assignment to
If that doesn’t work I’d do a
gem which gcal4ruby(or whatever the name of the gem is) and look at the code there. Because according to the source code thestartmethod definitely exists.