Ruby Google Calendar Integration Watch Event / Push Notification -
the following snippet of code print events calendar id, calendar configured , try set watch notification on calendar.
everything works the watch event method. i'm getting error: apis/core/http_command.rb:212:in `check_status': unauthorized (google::apis::authorizationerror)
thi seems strange since calendars , events retrieve working fine.
service = google::apis::calendarv3::calendarservice.new service.client_options.application_name = application_name service.authorization = authorize # fetch next 10 events user calendar_id = 'us7i4kt2to4mpb0b5et1f9f4co@group.calendar.google.com' response = service.list_events(calendar_id, max_results: 10, single_events: true, order_by: 'starttime', time_min: time.now.iso8601) puts "upcoming events:" puts "no upcoming events found" if response.items.empty? response.items.each |event| start = event.start.date || event.start.date_time puts "- #{event.summary} (#{start})" end @calendar_list = service.list_calendar_lists @calendar_list.items.each |calendar| puts " #{calendar.summary} => #{calendar.id}" end channel = google::apis::calendarv3::channel.new(address: 'https://66724be7.ngrok.io', id: 100, type: "web_hook") puts "channel created " webhook = service.watch_event('us7i4kt2to4mpb0b5et1f9f4co@group.calendar.google.com', channel, single_events: true, time_min: time.now.iso8601)
i'm getting error: apis/core/http_command.rb:212:in `check_status': unauthorized (google::apis::authorizationerror)
can't find related on web
Comments
Post a Comment