Google api 客户端 calendarv3 事件初始化参数错误
Google api client calendarv3 event initialization argument error
我正在使用 google_api_client 0.10.3。我有这个电话:
Google::Apis::CalendarV3::Event.new({
'summary' => summary,
'description' => description,
'start' => event_datetime(check_out_time),
'end' => event_datetime(check_out_time),
})
不知何故我收到了这个错误:
ArgumentError: wrong number of arguments (given 1, expected 0)
from .../gems/google-api-client-0.10.3/generated/google/apis/calendar_v3/classes.rb:964:in `initialize'
这太令人费解了,因为 class 定义实际上采用参数:
def initialize(**args)
有什么帮助吗?
在散列中使用符号作为键,而不是字符串。
Google::Apis::CalendarV3::Event.new(
summary: summary,
description: description,
start: event_datetime(check_out_time),
end: event_datetime(check_out_time),
)
在 ruby 中,双 splat 运算符 (**
) 用于捕获 关键字 参数 - 按照设计,这些参数必须始终是符号。
我正在使用 google_api_client 0.10.3。我有这个电话:
Google::Apis::CalendarV3::Event.new({
'summary' => summary,
'description' => description,
'start' => event_datetime(check_out_time),
'end' => event_datetime(check_out_time),
})
不知何故我收到了这个错误:
ArgumentError: wrong number of arguments (given 1, expected 0)
from .../gems/google-api-client-0.10.3/generated/google/apis/calendar_v3/classes.rb:964:in `initialize'
这太令人费解了,因为 class 定义实际上采用参数:
def initialize(**args)
有什么帮助吗?
在散列中使用符号作为键,而不是字符串。
Google::Apis::CalendarV3::Event.new(
summary: summary,
description: description,
start: event_datetime(check_out_time),
end: event_datetime(check_out_time),
)
在 ruby 中,双 splat 运算符 (**
) 用于捕获 关键字 参数 - 按照设计,这些参数必须始终是符号。