微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby-on-rails – 在rails中的Google freebusy api调用无法识别参数

我试图从我的主日历中找到所有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'})

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐