Google Calendar V3 Ruby API insert event -


i using example https://developers.google.com/google-apps/calendar/v3/reference/events/insert

event = google::apis::calendarv3::event.new{   summary:'google i/o 2015',   location:'800 howard st., san francisco, ca 94103',   description:'a chance hear more google\'s developer products.',   start: {     date_time: '2015-05-28t09:00:00-07:00',     time_zone:'america/los_angeles',   },   end: {     date_time:'2015-05-28t17:00:00-07:00',     time_zone:'america/los_angeles',   } }  result = service.insert_event(calendar_id, event) 

however, got error:

wwtlf:~/workspace $ ruby test.rb  /usr/local/rvm/gems/ruby-2.3.0/gems/google-api-client-0.9.1/lib/google/apis/core/http_command.rb:202:in `check_status': required: missing end time. (google::apis::clienterror)         /usr/local/rvm/gems/ruby-2.3.0/gems/google-api-client-0.9.1/lib/google/apis/core/api_command.rb:103:in `check_status'         /usr/local/rvm/gems/ruby-2.3.0/gems/google-api-client-0.9.1/lib/google/apis/core/http_command.rb:170:in `process_response'         /usr/local/rvm/gems/ruby-2.3.0/gems/google-api-client-0.9.1/lib/google/apis/core/http_command.rb:275:in `execute_once'         /usr/local/rvm/gems/ruby-2.3.0/gems/google-api-client-0.9.1/lib/google/apis/core/http_command.rb:107:in `block (2 levels) in execute'         /usr/local/rvm/gems/ruby-2.3.0/gems/retriable-2.1.0/lib/retriable.rb:54:in `block in retriable'         /usr/local/rvm/gems/ruby-2.3.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `times'         /usr/local/rvm/gems/ruby-2.3.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `retriable'         /usr/local/rvm/gems/ruby-2.3.0/gems/google-api-client-0.9.1/lib/google/apis/core/http_command.rb:104:in `block in execute'         /usr/local/rvm/gems/ruby-2.3.0/gems/retriable-2.1.0/lib/retriable.rb:54:in `block in retriable'         /usr/local/rvm/gems/ruby-2.3.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `times'         /usr/local/rvm/gems/ruby-2.3.0/gems/retriable-2.1.0/lib/retriable.rb:48:in `retriable'         /usr/local/rvm/gems/ruby-2.3.0/gems/google-api-client-0.9.1/lib/google/apis/core/http_command.rb:96:in `execute'         /usr/local/rvm/gems/ruby-2.3.0/gems/google-api-client-0.9.1/lib/google/apis/core/base_service.rb:267:in `execute_or_queue_command'         /usr/local/rvm/gems/ruby-2.3.0/gems/google-api-client-0.9.1/generated/google/apis/calendar_v3/service.rb:1207:in `insert_event' 

what wrong event object example? tried use datetime insted of date_time, error same.

upd: original example:

event = google::apis::calendarv3::event.new{   summary: 'google i/o 2015',   location: '800 howard st., san francisco, ca 94103',   description: 'a chance hear more google\'s developer products.',   start: {     date_time: '2015-05-28t09:00:00-07:00',     time_zone: 'america/los_angeles',   },   end: {     date_time: '2015-05-28t17:00:00-07:00',     time_zone: 'america/los_angeles',   },   recurrence: [     'rrule:freq=daily;count=2'   ],   attendees: [     {email: 'lpage@example.com'},     {email: 'sbrin@example.com'},   ],   reminders: {     use_default: false,     overrides: [       {method' => 'email', 'minutes: 24 * 60},       {method' => 'popup', 'minutes: 10},     ],   }, } 

enter image description here obviously, there lot of syntax errors. (missed ')method' => 'popup', 'minutes(missed '): 10

so, decided modify it:

event = google::apis::calendarv3::event.new{   summary:'google i/o 2015',   location:'800 howard st., san francisco, ca 94103',   description:'a chance hear more google\'s developer products.',   start: {     date_time:'2015-05-28t09:00:00-07:00',     time_zone:'america/los_angeles',   },   end: {     date_time:'2015-05-28t17:00:00-07:00',     time_zone:'america/los_angeles',   },   recurrence: [     'rrule:freq=daily;count=2'   ],   attendees: [     {email: 'lpage@example.com'},     {email: 'sbrin@example.com'},   ],   reminders: {     use_default: false,     overrides: [       {'method' => 'email', 'minutes'=> 24 * 60},       {'method' => 'popup', 'minutes'=> 10},     ],   } } 

but, still got http_command.rb:202:in `check_status': required: missing end time. (google::apis::clienterror)

for me, atm, works syntax:

google::apis::calendarv3::event.new({   :summary => 'event title',   :location => 'event address',   :description => 'event description',   :start => {     :date_time => 'event start time in rfc3339'   },   :end => {     :date_time => 'event end time in rfc 3339'   } }) 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -