Question

I have this code :

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)

and it's working :) But, can someone give me an example or a link to show me :) How can I get user's events and update them?

rails -v
Rails 3.2.13

ruby -v
ruby 1.9.3p327 (2012-11-10) [x86_64-darwin12.2.0]

my Gemfile:

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

Thank you very much.

Was it helpful?

Solution

I used this gem and it worked fine.

But it doesn't use Google API, just log in with Gmail account and password and parse its response.

So I wonder this gem is good for you. Anyway, try it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top