itrigga-admin_api_client

Wraps API calls to iTrigga Applications

Each API call requires an :api_key. All calls to the api module also require either a :site or :site_id

Other calls many require different params. If these are not provided then an exception is raised.

Example: Trigga::AdminApiClient.get_stats(:api_key => “fDhtXwx8_Mpx9evOsxXf”)

Hits this endpoint: localhost:3000/admin/stats.json?api_key=fDhtXwx8_Mpx9evOsxXf

And returns: {

           "api_calls" => 149,
         "max_item_id" => 218,
       "max_source_id" => 10,
         "item_counts" => {
    "aggregated" => 1,
     "editorial" => 22
},
         "status_code" => 200,
"max_scheduled_job_id" => 1252

}

Each call will return results as a Mash.

Each call will return a :status_code (normally 200 for when it went ok, else an error code eg 500)

If an error occurs a Mash will be returned like:

"status_code" => 500,
"error"       => "500 Error description goes in here"

With the HTTP status_code from the remote call and the exception message.

Installation

Rails2:

gem install itrigga-admin_api_client

Put this in the config/environment.rb file: config.gem ‘itrigga-admin_api_client’, :lib => ‘itrigga/admin_api_client’

Rails3:

Put this in the Gemfile: gem ‘itrigga-admin_api_client’, :lib => ‘itrigga/admin_api_client’

Run ‘bundle install’

Overriding configuration

If the default configuration.yml file is not to your taste it can be overridden by setting ENV to the absolute url of a yml file with the same format to use instead. The format needs to be: RAILS_ENV:

admin:
  base_url: xxxxxx
api:
  base_url: xxxxxx
search_tracker:
  base_url: xxxxxx

Where the base_url for each component is an absolute URL

Contributing to itrigga-admin_api_client

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2011 Anson. See LICENSE.txt for further details.