event = Google::Apis::CalendarV3::Event.new({
"summary":"appointment",
"description":"placeholder",
"start": {
"date_time":'2016-05-28T08:00:00',
"time_zone":'Europe/Brussels',
},
"end": {
"date_time":'2016-05-28T09:00:00',
"time_zone":'Europe/Brussels',
},
'reminders': {
'useDefault': false,
'overrides': [
{'minutes': 840, 'method': 'popup'}
]
},
"color_id": "11"
})
result = service.insert_event('primary', event)
我正在尝试通过ruby API插入日历事件。此代码提供以下错误:
/usr/local/rvm/gems/ruby-2.3.1/gems/google-api-client-0.9.6/lib/google/apis/core/http_command.rb:211:in `check_status': cannotUseDefaultRemindersAndSpecifyOverride: Cannot specify both default reminders and overrides at the same time. (Google::Apis::ClientError)
非常感谢任何帮助。
答案 0 :(得分:3)
可能有点晚了,但我遇到了同样的问题,我找到了解决方法。
创建event
而不使用reminders
。使用初始值设定项创建event
后,会设置如下提醒:
event.reminders = Google::Apis::CalendarV3::Event::Reminders.new(
use_default: false,
overrides: [
Google::Apis::CalendarV3::EventReminder.new(reminder_method:"popup", minutes: reminder_minutes),
Google::Apis::CalendarV3::EventReminder.new(reminder_method:"email", minutes: reminder_minutes)
]
)
这对我有用!