[![Build Status](https://magnum.travis-ci.com/access-development/api-ruby.svg?token=T9pynazhFyqzCqj2LUNj&branch=master)](https://magnum.travis-ci.com/access-development/api-ruby) [![Code Climate](https://codeclimate.com/repos/5466a5ce69568076f20003de/badges/9bf8e7713208de5ce932/gpa.svg)](https://codeclimate.com/repos/5466a5ce69568076f20003de/feed) # Access API A ruby wrapper for the Access API ## Installation ```ruby gem 'access' ``` And then execute: $ bundle Or install it yourself as: $ gem install access ## Setup ###Config setup You can configure the following options: - `access_token` **Required** - `format`: Set as `'json'` or `'xml'`. Default is `'json'` - `api_environment`: Set as `'staging'` or `'production'`. Default is `'staging'` - `api_version`: `'v1'` is default. - `hashify` Returns the results all using Hashie::Mash if `'true'`, Default is `'false'` #### Config via Environment Variables You can set config settings by creating environment variables called: `ENV['ACCESS_TOKEN']`, `ENV['ACCESS_FORMAT']`, `ENV['ACCESS_ENVIRONMENT']`, `ENV['ACCESS_VERSION']`, `ENV['ACCESS_HASHIFY']` #### Config via Initializer You can also create an initializer file to set up a config ```ruby Access.configure do |config| config.access_token = ENV['ACCESS_TOKEN'] config.hashify = 'true' end ``` You can also set them one at a time `Access.config.format = 'xml'` ###Making Calls ####Offer ```ruby Access::Offer.search options ``` ```ruby Access::Offer.find **offer_key** options, member_key: **your-member-key** ``` ####Store ```ruby Access::Store.search options ``` ```ruby Access::Store.find store_key options ``` ####Location ```ruby Access::Location.search options ``` ```ruby Access::Location.find location_key options ``` ####Category ```ruby Access::Category.search options ``` ```ruby Access::Category.find key options ``` ####Report ```ruby Access::Report.usage options ``` ```ruby Access::Report.usage token options ``` ####Token ```ruby Access::Token.verify options ``` ```ruby Access::Token.verify_other token options ``` ####Redeem ```ruby Access::Redeem.redeem_offer key nil options` *member_key required ``` ```ruby Access::Redeem.redeem_offer key redeem_type options` *member_key required ``` ####Member ## Contributing 1. Fork it ( https://github.com/access-development/api-ruby/fork ) 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create a new Pull Request