Google Calendar API的“start-min”参数没有做任何事情

时间:2013-05-05 11:57:43

标签: ruby-on-rails google-calendar-api

这是我的代码:

oauth_yaml = YAML.load_file('google-api.yaml')
client = Google::APIClient.new
client.authorization.client_id = oauth_yaml["client_id"]
client.authorization.client_secret = oauth_yaml["client_secret"]
client.authorization.scope = oauth_yaml["scope"]
client.authorization.refresh_token = @rtoken
client.authorization.access_token = @token

if client.authorization.refresh_token && client.authorization.expired?
  client.authorization.fetch_access_token!
end

service = client.discovered_api('calendar', 'v3')
result = client.execute(
  :api_method => service.events.list,
  :parameters => {'calendarId' => @calendar, 'start-min' => Time.now.xmlschema},
  :headers => {'Content-Type' => 'application/json'}
)

@parsed = JSON.parse(result.data.to_json)

无论是否包含'start-min'参数,我都会收到所有事件。我在这里做错了吗?

感谢。

1 个答案:

答案 0 :(得分:0)

正确的参数实际上是timeMin,而不是start-min。