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'})

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...