Skip to content

Instantly share code, notes, and snippets.

@masonforest
Created June 3, 2011 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masonforest/1006561 to your computer and use it in GitHub Desktop.
Save masonforest/1006561 to your computer and use it in GitHub Desktop.
require 'sinatra'
require 'google_oauth'
client = GoogleOAuth::Client.new(
:client_id => 'XXXX',
:client_secret => 'XXXX',
:redirect => 'http://localhost:4567/oauth2callback',
)
get '/' do
redirect client.authorize_url
end
get '/oauth2callback' do
session[:token] ||= client.authorize(:code => params[:code])
calendar = client.own_calendars.items.first
client.events(calendar.eventFeedLink).items.each do |event|
puts event.title
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment