我使用以下代码并且它可以工作,但突然间它无法正常工作。我有另一种方法,使用相同的身份验证获得自由忙,一切正常。下面是我的方法以及控制台日志。
def createEvent(title, event_description, mentor, mentee, start_time, end_time)
calendar_api = Google::Apis::CalendarV3::CalendarService.new
calendar_api.authorization = @auth
event = Google::Apis::CalendarV3::Event.new(
summary: title,
description: event_description,
start: {
date_time: start_time.iso8601,
time_zone: 'Etc/UTC',
},
end: {
date_time: end_time.iso8601,
time_zone: 'Etc/UTC',
},
attendees: [
{email: mentor},
{email: mentee},
],
reminders: {
use_default: true,
},
)
calendar_api.insert_event('primary', event)
end
我得到的控制台错误如图所示
Sending HTTP post https://www.googleapis.com/calendar/v3/calendars/primary/events?
400
#<Hurley::Response POST https://www.googleapis.com/calendar/v3/calendars/primary/events == 400 (276 bytes) 300ms>
Caught error invalid
Error - #<Google::Apis::ClientError: invalid>
答案 0 :(得分:0)
根据建议here,尝试在调试会话中放置一个断点,以了解错误的来源。此外,如果您使用Representable.deprecations = false
升级到3.0或关闭弃用,则会解决警告。您还可以查看以下参考文献:https://github.com/google/google-api-ruby-client/issues/407和https://github.com/trailblazer/representable/issues/195