ruby-on-rails – 在rails中的Google freebusy api调用无法识别
发布时间:2020-12-17 03:37:12 所属栏目:百科 来源:网络整理
导读:我试图从我的主日历中找到所有freebusy时间,但我无法通过查询来识别我的参数. 在我的控制器中我有: @freetimes = client.execute( :api_method = service.freebusy.query,:parameters = { 'timeMin' = '2013-06-15T17:06:02.000Z','timeMax' = '2013-06-29T
我试图从我的主日历中找到所有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'}) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |