我有这个代码:
client = Google::APIClient.new
oauth_yaml = YAML.load_file('lib/.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 = oauth_yaml["refresh_token"]
client.authorization.access_token = oauth_yaml["access_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.settings.list)
它正在工作:) 但是,有人可以给我一个例子或一个链接来告诉我:) 我怎样才能获取用户的事件并更新它们?
rails -v
Rails 3.2.13
ruby -v
ruby 1.9.3p327 (2012-11-10) [x86_64-darwin12.2.0]
我的宝石文件:
gem 'google-api-client'
gem 'googlecalendar'
gem 'gdata'
gem 'sinatra'
gem 'logger'
gem 'gdata_19'
非常感谢。