Skip to content

Instantly share code, notes, and snippets.

@bluemango
Created July 14, 2010 17:47
Show Gist options
  • Save bluemango/475741 to your computer and use it in GitHub Desktop.
Save bluemango/475741 to your computer and use it in GitHub Desktop.
require "google_util"
consumer = OAuth::Consumer.new('anonymous', 'anonymous', {
:site => 'https://www.google.com',
:request_token_path => '/accounts/OAuthGetRequestToken',
:access_token_path => '/accounts/OAuthGetAccessToken',
:authorize_path => '/accounts/OAuthAuthorizeToken'
})
request_token = consumer.get_request_token({}, {:scope => 'https://www.google.com/calendar/feeds/default/private/full'})
puts request_token.authorize_url
access_token = request_token.get_access_token(:oauth_verifier => THE_TOKEN_YOU_GET_FROM_THE_SITE)
puts access_token.token
puts access_token.secret
client = Google::Client.new(access_token, '2.0')
feed = client.get('https://www.google.com/calendar/feeds/default/private/full', {
'xoauth_requestor_id' => "admin@visualfaq.com",
'orderby' => 'starttime',
'singleevents' => 'true',
'sortorder' => 'a',
'start-min' => Time.now.strftime('%Y-%m-%dT%H:%M:%S')
})
## I get back a valid feed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment