README.md in access-1.1.7 vs README.md in access-2.0.0

- old
+ new

@@ -5,11 +5,11 @@ A ruby wrapper for the Access API ## Installation ```ruby -gem 'access' + gem 'access', '~> 2.0.0' ``` And then execute: $ bundle @@ -23,116 +23,252 @@ ###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'` + - `api_environment`: Set as `'demo'` or `'production'`. Default is `'demo'` + - `return_json`: Set as `'true'` or `'false'`. Default is `'false'` return ruby objects. + - `hashify`: Set as `'true'` or `'false'`. Default is `'false'` return a hashed version of the json response if `return_json` is set to 'true' #### 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']` +`ENV['ACCESS_TOKEN']`, `ENV['ACCESS_ENVIRONMENT']`, `ENV['ACCESS_RETURN_JSON']`, `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'` +`Access.config.access_token = ENV['ACCESS_TOKEN']` +### Config via Params + +`return_json` can be overwritten by passing in by passing the param `return_json` to the end of any call that accepts options. + +`hashify` can be overwritten by passing in by passing the param `hashify` to the end of any call that accepts options. + ###Making Calls ####Offer ```ruby -Access::Offer.search options +Access::Offer.search options, member_key: **your-member-key** ``` ```ruby -Access::Offer.find **offer_key** options, member_key: **your-member-key** +Access::Offer.find **offer_key**, options, member_key: **your-member-key** ``` ####Store ```ruby -Access::Store.search options +Access::Store.search options, member_key: **your-member-key** ``` ```ruby -Access::Store.find store_key options +Access::Store.find **store_key**, options, member_key: **your-member-key** ``` +```ruby +Access::Store.national options, member_key: **your-member-key** +``` + ####Location ```ruby -Access::Location.search options +Access::Location.search options, member_key: **your-member-key** ``` ```ruby -Access::Location.find location_key options +Access::Location.find **location_key**, options, member_key: **your-member-key** ``` ####Category ```ruby -Access::Category.search options +Access::Category.search options, member_key: **your-member-key** ``` ```ruby -Access::Category.find key options +Access::Category.find **category_key**, options, member_key: **your-member-key** ``` +####Autocomplete + +```ruby +Access::Autocomplete.search options +``` + +```ruby +Access::Autocomplete.search_stores options +``` + +```ruby +Access::Autocomplete.search_categories options +``` + +```ruby +Access::Autocomplete.search_offers options +``` + +```ruby +Access::Autocomplete.search_locations options +``` + +####Redeem + +```ruby +Access::Redeem.redeem_offer **key**, nil, options, member_key: **your-member-key** +``` + +```ruby +Access::Redeem.redeem_offer **offer_key**, **redeem_type**, options, member_key: **your-member-key** +``` + +####Member + +####City Savings + +```ruby +Access::CitySavings.search_city_savings options, member_key: **your-member-key** +``` + +####Channel + +```ruby +Access::Channel.search options +``` + +```ruby +Access::Channel.find **channel_key**, options +``` + +####Campaign + +```ruby +Access::Campaign.search options +``` + +```ruby +Access::Campaign.find **campaign_key**, options +``` + +###Spot + +```ruby +Access::Spot.search_by_channel **channel_key**, options +``` + +```ruby +Access::Spot.search_by_campaign **campaign_key**, options +``` + +```ruby +Access::Spot.find **spot_key**, options +``` + +###Internal Admin only Calls + +###Filter + +```ruby +Access::Filter.search options +``` + +```ruby +Access::Filter.find **filter_key**, options +``` + ####Report ```ruby +Access::Report.all_usage options +``` + +```ruby Access::Report.usage options ``` ```ruby -Access::Report.usage token options +Access::Report.usage_other **token**, options ``` ####Token ```ruby -Access::Token.verify options +Access::Token.search options ``` ```ruby -Access::Token.verify_other token options +Access::Token.find **token**, options ``` -####Redeem +####Oauth Application ```ruby -Access::Redeem.redeem_offer key nil options` *member_key required +Access::OauthApplication.search options ``` ```ruby -Access::Redeem.redeem_offer key redeem_type options` *member_key required +Access::OauthApplication.find **application_id**, options ``` -####Member +```ruby +Access::OauthApplication.search_tokens **application_id**, options +``` +```ruby +Access::OauthApplication.find_token **application_id**, **token_id**, options +``` +```ruby +Access::OauthApplication.create_token **application_id**, options +``` + +```ruby +Access::OauthApplication.create **application_id**, options +``` + +```ruby +Access::OauthApplication.update **application_id**, options +``` + +```ruby +Access::OauthApplication.delete **application_id**, options +``` + +####Verify + +```ruby + Access::Verify.token options +``` + +```ruby + Access::Verify.filter options +``` + ## 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 +### Running the Tests +`ACCESS_TOKEN=**your-access-token** rake` +`ACCESS_TOKEN=*your-access-token** guard` + +### Running the Gem in Console + +`ACCESS_TOKEN=*your-access-token** ruby bin/console`