Reputation: 111
I am updating availables shifts in a google calendar to book meetings. I would like to send a email invitiation when I add a new attendee.
I have tried event.sendNotifications
but it is now deprecated.
So I move on event.sendUpdates = 'all'
but it is raising an error :
NoMethodError in PagesController#book undefined method sendUpdates=' for #<Google::Apis::CalendarV3::Event:0x00007ff2a9b12ff8>
Here is my code :
service = init_google_api
event_id = params[:id]
event = service.get_event(ENV['CALENDAR_ID'], event_id)
event.summary = "confirmed"
event.sendUpdates = 'all'
event.attendees = [
{
email:'[email protected]',
responseStatus: 'accepted'
}
]
result = service.update_event(ENV['CALENDAR_ID'], event.id, event)
event = service.get_event(ENV['CALENDAR_ID'], event_id)
result = service.update_event(ENV['CALENDAR_ID'], event.id, event)
When I remove the line event.sendUpdates = 'all'
, everything is working well.
If someone knows how to fix it or where is my error. Thanks !
Upvotes: 0
Views: 530
Reputation: 201368
At calendar API, sendUpdates
is used as the query parameter. So how about this modification?
result = service.update_event(ENV['CALENDAR_ID'], event.id, event)
result = service.update_event(ENV['CALENDAR_ID'], event.id, event, send_updates: 'all')
If this was not the result you want, I apologize.
Upvotes: 4