Project

jibeset

0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby wrapper for the jibeset REST and Search APIs
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Jibeset

Configure

# Configure your client with the credentials you got from
# registering your application at jibeset.heroku.com/oauth_clients
Jibeset.configure do |config|
  config.client_id      = 'YOUR_CLIENT_ID'
  config.client_secret  = 'YOUR_CLIENT_SECRET'
  config.endpoint       = 'http://jibeset.heroku.com/'
  config.oauth_callback = 'http://yourapp.example.com/oauth_callback'
end

Authorization Flow

# Get an authorization code from the JibeSet OAuth Provider
# Pretend this is in a sinatra app
get '/auth/oauth' do
  redirect Jibeset.authorize_url
end

# Use the authorization code to get an access code
# This will be the action that your callback URL redirects to
get '/auth/oauth/callback' do  
  response = Jibeset.get_access_token(params[:code], :redirect_uri => oauth_callback)
  token = JSON.parse(response.body)["access_token"]
  # Store the access token in the session so you can get it later to sign
  # subsuquent requests.
  session[:jibeset_token] = token
  # Create a client
  client = Jibeset.client(:access_token => token)
  client.me # => returns authenticated user
end