1

私はこのコードを持っています:

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]

私のGemfile:

gem 'google-api-client'
gem 'googlecalendar'
gem 'gdata'
gem 'sinatra'
gem 'logger'
gem 'gdata_19'

どうもありがとうございました。

4

1 に答える 1

2

私はこのgemを使用しましたが、うまくいきました。

ただし、Google API は使用せず、Gmail アカウントとパスワードでログインし、応答を解析するだけです。

だから、この宝石はあなたに良いのだろうか。とにかく、試してみてください。

于 2013-09-11T08:02:26.543 に答える