GitXplorerGitXplorer
t

eventful_api

public
2 stars
12 forks
2 issues

Commits

List of commits on branch master.
Unverified
b23db2b69d7bbbe6fcb2090474897d87fb09b312

Correct typo in README

ttekin committed 12 years ago
Unverified
a656f6d64741e6e0d052d4064ed91cdf7cebf561

Merge pull request #2 from karora/master

ttekin committed 12 years ago
Unverified
5a613268bc33d10ca4d2567936bec42884146a87

Correct typos in the documentation.

committed 12 years ago
Unverified
b9fdf627cdcdee52ed46fb4b69f9055d08036c6c

Update README.md

ttekin committed 12 years ago
Unverified
1e7c3fe891fb011b7339cf9152e580be4f1b4784

Ready README for release

ttekin committed 12 years ago
Unverified
566505b1248616f225b05f2d99484257aca366fe

Be more specific with gem dependencies

ttekin committed 12 years ago

README

The README file for this repository.

EventfulApi

Build Status

A Ruby library for accessing the eventful.com API. It supports their new OAuth authentication method.

Installation

gem install eventful_api

## Configuration and usage

The Eventful API requires authentication via OAuth 1.0 to access resources on behalf of Eventful users. You can register your application at http://api.eventful.com/keys. Once registered, you'll need to generate your OAuth consumer and secret.

Configure EventfulApi with your application key, OAuth consumer key and your OAuth consumer secret:

  EventfulApi.configure do |config|
    config.application_key = YOUR_APPLICATION_KEY
    config.consumer_key = YOUR_CONSUMER_KEY
    config.consumer_secret = YOUR_CONSUMER_SECRET
  end

You can make requests on behalf of a user once you have acquired their OAuth access token/secret pair by instantiating an EventfulApi::Client:

  client = EventfulApi::Client.new(:oauth_token => 'token', :oauth_secret => 'token secret')

  responsh_hash = client.post('/events/new', event_param_hash)
  response_hash = client.get('/events/get', {:id => 'E0-001-053639493-9'})

EventfulApi makes requests to Eventful's JSON interface, returning the Hash equivalent of the JSON responses.

OAuth authentication

You are free to acquire OAuth authorization from your users using your own process. However, EventfulApi does provide a convenient facade for generating both request tokens and access tokens.

Step 1. Requesting a token and redirect the user

  request_token = EventfulApi.get_request_token(:oauth_callback => 'http://example.com/callback')
  # store the request token and secret for later use and redirect the user
  session[:request_token] = request_token.token
  session[:request_secret] = request_token.secret
  redirect_to token.redirect_url

Step 2. Acquiring an access token during the callback

  # Reconstruct the request token using the token and secret saved in the session
  request_token = OAuth::RequstToken.new(EventfulApi.oauth_consumer, session[:request_token], session[:request_secret])
  # Get an access token from Eventful using the oauth_verifier param
  access_token = request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])
  # You now have a verified token and secret ready to create a client
  client = EventfulApi::Client.new(:oauth_token => access_token.token, :oauth_secret => access_token.secret)

License

Released under the MIT License. See the LICENSE file for further details.