2017-09-13 12 views
0

google_api_client 0.10.3을 사용하고 있습니다. 나는이 전화를 가지고 :Google api 클라이언트 calendarv3 이벤트 초기화 인수 오류

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' 

사실 클래스 정의가 인수 걸립니다 이것은 매우 당혹입니다 :

def initialize(**args) 

어떤 도움을 ?

답변

1

문자열을 사용하지 않고 기호를 키로 사용하십시오. 루비에서

Google::Apis::CalendarV3::Event.new(
    summary: summary, 
    description: description, 
    start: event_datetime(check_out_time), 
    end: event_datetime(check_out_time), 
) 

는 이중 플랫 연산자 (**는) 키워드를 인수를 캡처입니다 - 디자인에 의해, 항상 기호를해야한다.

+0

저장된 내 하루. 감사합니다! – EJ2015