Skip to content

Latest commit

 

History

History
70 lines (41 loc) · 1.98 KB

README.md

File metadata and controls

70 lines (41 loc) · 1.98 KB

Crowdtilt API Ruby Client

An extremely light-weight ruby-based http client for the Crowdtilt API

For the latest information on this project, take a look at:

##Usage Examples##

###Including the gem in your Gemfile###

gem 'crowdtilt'

###Initializing the client### Your api_key / api_secret is required to initialize the client. Please email [[email protected]](mailto: [email protected]) to request credentials.

You should specify with the mode parameter whether you are attempting to access the sandbox API or the production API.

Crowdtilt.configure :api_key => YOUR_API_KEY,
                    :api_secret => YOUR_API_SECRET,
                    :mode => API_MODE   # 'sandbox' or 'production'

###API methods###

Responses are returned as hashes.

Errors returned by the API will be raised as exceptions.

Examples:

Create a user:

user = Crowdtilt.create_user({
  :firstname => 'John',
  :lastname => 'Smith',
  :email => '[email protected]'
})

Get a list of users:

users = Crowdtilt.get_users

Get a specific of user:

user = Crowdtilt.get_user('USR123')

Update a user:

user = Crowdtilt.update_user('USR123', { :email => '[email protected]' })

Raw requests:

You can make raw requests by invoking the lower level api methods get, post, and put. See Crowdtilt's API documentation for more information about the list of available resources. Methods are called by simply passing in the URI of the resource you are accessing, along with any needed data as a hash object.

Create a user:

user = {
  :firstname => 'John',
  :lastname => 'Smith',
  :email => '[email protected]'
}

response = Crowdtilt.post('/users', { :user => user })

Get a list of users:

response = Crowdtilt.get('/users')