我正在尝试通过oauth google获取登录用户的所有日历。截至目前,我可以获取主日历中的所有事件,但我也想显示用户的所有公共日历。获取登录用户的所有日历列表(Google日历API)
尝试了一切,但找不到任何方法来提取日历。这是我正在开发的Rails 5应用程序上的一个红宝石。
代码以获取事件当月
response = client.execute(api_method: service.events.list,
parameters: { 'calendarId' => 'primary',
'timeMin': Time.now.beginning_of_month.iso8601,
'showDeleted': false,
'singleEvents': true,
'maxResults': 10,
'orderBy': 'startTime'},
headers: { 'Content-Type' => 'application/json' })
我试图client.calendarList.list但它显示错误“未定义的方法calendarList”
感谢提前的帮助。
就像在这[post](http://stackoverflow.com/questions/28772554/google-calendar-api-cant-list-events-from-secondary-calendar)中,其他日历有自己的ID。日历API没有任何可合并不同日历的功能。因此,一种解决方案是,使用[CalendarList:list](https://developers.google.com/google-apps/calendar/v3/reference/calendarList/list)返回用户日历列表中的条目,然后您可以遍历他们每个人的事件。 [源](http://stackoverflow.com/questions/35169118/how-to-get-all-events-from-google-calendar-using-google-calendar-api) – KENdi