我试图从我的主日历中找到所有freebusy时间,但我无法通过查询来识别我的参数.
在我的控制器中我有:
@freetimes = client.execute( :api_method => service.freebusy.query,:parameters => { 'timeMin' => '2013-06-15T17:06:02.000Z','timeMax' => '2013-06-29T17:06:02.000Z','items' => [{'id' => 'myemail@gmail.com'}] },:headers => {'Content-Type' => 'application/json'})
我得到的回应是:
--- !ruby/object:Google::apiclient::Schema::Calendar::V3::FreeBusyResponse data: error: errors: - domain: global reason: required message: Missing timeMin parameter. code: 400 message: Missing timeMin parameter.
--- !ruby/object:Google::apiclient::Result request: !ruby/object:Google::apiclient::Request parameters: timeMin: '2013-06-15T17:06:02.000Z' timeMax: '2013-06-29T17:06:02.000Z' items: - id: myemail@gmail.com
任何帮助解决这个问题将不胜感激!
解决方法
通过指定请求体来解决这个问题
client.execute( :api_method => service.freebusy.query,:body => JSON.dump({ :timeMin =>,:timeMax =>,:items => }),:headers => {'Content-Type' => 'application/json'})