我正在使用 Google 日历 API 并遇到了这个问题:
Ruby 代码似乎不是 Ruby 代码,因此我将来自 calendar_list 和 calendar.get 的信息移植到此。我不确定为什么没有将参数摘要作为标题。
def create
@auth = request.env["omniauth.auth"]
@token = @auth["credentials"]["token"]
client = Google::APIClient.new
client.authorization.access_token = @token
service = client.discovered_api('calendar', 'v3')
@result = client.execute(
:api_method => service.calendars.insert,
:parameters => {"summary" => 'Calendar Title'},
:headers => {'Content-Type' => 'application/json'})
end
这导致错误
--- !ruby/object:Google::APIClient::Schema::Calendar::V3::Calendar
data:
error:
errors:
- domain: global
reason: required
message: Missing title.
code: 400
message: Missing title.