Project

gaah

0.0
No commit activity in last 3 years
No release in over 3 years
Google Apps Marketplace API wrapper in ruby for Distill.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.5

Runtime

~> 1.5
~> 0.4
~> 0.9
 Project Readme

GAAH - Google Apps API Helper

GAAH 0.5 Incompatibility Notice

Gaah version 0.5.x and later are NOT compatibel with Gaah 0.3.x Gaah version 0.3 and above require OAuth2 flow - now a mandatory requirement from Google for new applications.

Please upgrade to 0.5 if you are planning to use OAuth2, otherwise stick with the 0.3.x branch version

API Wrapper for Google Apps Marketplace

Currently supports:

Directory API (read-only)

Calendar API

Example Code

CLIENT_KEY = '000000000000.apps.googleusercontent.com'
CLIENT_SECRET = 'abcdefghijklmnopqrstuvwx'
REDIRECT_URI = 'http://localhost:3021/oauth2' #as set in your application in Google

# Setup
require 'gaah'
Gaah.setup_oauth2(CLIENT_KEY, CLIENT_SECRET, REDIRECT_URI)

# Obtain a valid OAuth2 token
gh = Gaah::ApiClient.new
authorization_url = gh.oauth2_authorization_uri

...redirect the user to login on the authorization_url. If authorized, the user will be redirected back with a valid access_code...

gh.access_code='#whatever_returned_by_google'

# Store your access token, refresh token somewhere for future usage

gh.storable_token #=> Store the token somewhere, db, etc

#... then in the future ...

gh = Gaah::OAuth.new(stored_token)

# Get users
users = Gaah::Directory::Api.users(gh)
user = users.first
user.id    # "https://apps-apis.google.com/a/feeds/example.com/user/2.0/bobert"
user.name  # "Bobert Jones"
user.title # "bobert"

# Get calendar events
events = user.events(gh)
event = events.first
event.title           # "Meeting with Joe"
event.when.start_time # 2013-04-16 13:00:00 -0400

# Get calendar resources *
rooms = Gaah::Resource::Api.resources(gh)
room = rooms.first
room.name # "U.S.S. Distill"
room.type # "Conference room"

Resources

Warning: Google documentation links sometimes move without good redirection.