access 1.1.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.coveralls.yml +1 -0
 - data/.gitignore +2 -0
 - data/.travis.yml +12 -0
 - data/Guardfile +7 -0
 - data/README.md +159 -23
 - data/Rakefile +13 -0
 - data/access.gemspec +6 -1
 - data/bin/console +14 -0
 - data/bin/setup +7 -0
 - data/lib/access.rb +21 -10
 - data/lib/access/api.rb +188 -64
 - data/lib/access/autocomplete.rb +11 -0
 - data/lib/access/campaign.rb +24 -0
 - data/lib/access/category.rb +16 -2
 - data/lib/access/channel.rb +24 -0
 - data/lib/access/city_savings.rb +16 -0
 - data/lib/access/config.rb +8 -7
 - data/lib/access/error.rb +8 -2
 - data/lib/access/filter.rb +30 -2
 - data/lib/access/info.rb +13 -0
 - data/lib/access/link.rb +17 -0
 - data/lib/access/location.rb +17 -2
 - data/lib/access/member.rb +11 -0
 - data/lib/access/oauth_application.rb +31 -0
 - data/lib/access/offer.rb +24 -20
 - data/lib/access/redeem.rb +11 -4
 - data/lib/access/report.rb +10 -0
 - data/lib/access/request.rb +25 -20
 - data/lib/access/response.rb +127 -0
 - data/lib/access/spot.rb +28 -0
 - data/lib/access/store.rb +16 -2
 - data/lib/access/token.rb +18 -0
 - data/lib/access/verify.rb +11 -2
 - data/lib/access/version.rb +1 -1
 - data/test/access/autocomplete_test.rb +53 -0
 - data/test/access/category_test.rb +64 -0
 - data/test/access/city_savings_test.rb +5 -0
 - data/test/access/filter_test.rb +40 -0
 - data/test/access/location_test.rb +59 -0
 - data/test/access/member_test.rb +5 -0
 - data/test/access/oauth_application_test.rb +91 -0
 - data/test/access/offer_test.rb +71 -0
 - data/test/access/redeem_test.rb +38 -0
 - data/test/access/report_test.rb +36 -0
 - data/test/access/store_test.rb +65 -0
 - data/test/access/token_test.rb +35 -0
 - data/test/access/verify_test.rb +29 -0
 - data/test/access/version_test.rb +9 -0
 - data/test/fixtures/autocomplete_search.yml +207 -0
 - data/test/fixtures/autocomplete_search_categories.yml +181 -0
 - data/test/fixtures/autocomplete_search_locations.yml +173 -0
 - data/test/fixtures/autocomplete_search_offers.yml +181 -0
 - data/test/fixtures/autocomplete_search_stores.yml +185 -0
 - data/test/fixtures/category_find.yml +303 -0
 - data/test/fixtures/category_search.yml +683 -0
 - data/test/fixtures/category_search_fail_member_key.yml +102 -0
 - data/test/fixtures/filter_find.yml +70 -0
 - data/test/fixtures/filter_search.yml +195 -0
 - data/test/fixtures/location_find.yml +923 -0
 - data/test/fixtures/location_search.yml +378 -0
 - data/test/fixtures/location_search_fail_member_key.yml +367 -0
 - data/test/fixtures/national_stores.yml +4135 -0
 - data/test/fixtures/oauth_application_find.yml +163 -0
 - data/test/fixtures/oauth_application_search.yml +134 -0
 - data/test/fixtures/oauth_application_search_fail_member_key.yml +268 -0
 - data/test/fixtures/oauth_application_token_find.yml +249 -0
 - data/test/fixtures/oauth_application_token_search.yml +98 -0
 - data/test/fixtures/offer_find.yml +683 -0
 - data/test/fixtures/offer_search.yml +329 -0
 - data/test/fixtures/offer_search_fail_member_key.yml +102 -0
 - data/test/fixtures/redeem_offer_no_redeem_type.yml +423 -0
 - data/test/fixtures/store_find.yml +333 -0
 - data/test/fixtures/store_search.yml +227 -0
 - data/test/fixtures/store_search_fail_member_key.yml +102 -0
 - data/test/fixtures/subcategory_find.yml +283 -0
 - data/test/fixtures/token_find.yml +245 -0
 - data/test/fixtures/token_search.yml +301 -0
 - data/test/fixtures/verify_filter.yml +290 -0
 - data/test/fixtures/verify_token.yml +78 -0
 - data/test/test_helper.rb +15 -0
 - metadata +183 -11
 - data/test/offers/offer_test.rb +0 -5
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: e083e07912e9391f135079ff737459f2d0dcbc3c
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: fc453c9ca589f35ac8fdbd36303771892960fe3c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 58137b7e514a16d52e944e16a989dad303d2ec44ddf910211be166a73bd2e5d4bf3daeab509c6ced7b8fa8b41409d63f272a5b0bb9f7f5965d457e1bd20c9213
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 79427cf14e906ba5d800a389f410627dcf5da884090e3e324ea31ac3d22ca0b89e8ed5f024a8dd1ff8b8f51f02eb9430cd2af6ec730e6e3bcf46f2a782ac8035
         
     | 
    
        data/.coveralls.yml
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            service_name: travis-pro
         
     | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/Guardfile
    ADDED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -7,7 +7,7 @@ A ruby wrapper for the Access API 
     | 
|
| 
       7 
7 
     | 
    
         
             
            ## Installation
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
            ```ruby
         
     | 
| 
       10 
     | 
    
         
            -
            gem 'access'
         
     | 
| 
      
 10 
     | 
    
         
            +
              gem 'access', '~> 2.0.0'
         
     | 
| 
       11 
11 
     | 
    
         
             
            ```
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
            And then execute:
         
     | 
| 
         @@ -25,16 +25,15 @@ Or install it yourself as: 
     | 
|
| 
       25 
25 
     | 
    
         
             
            You can configure the following options:
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
              - `access_token` **Required**
         
     | 
| 
       28 
     | 
    
         
            -
              - ` 
     | 
| 
       29 
     | 
    
         
            -
              - ` 
     | 
| 
       30 
     | 
    
         
            -
              - ` 
     | 
| 
       31 
     | 
    
         
            -
              - `hashify` Returns the results all using Hashie::Mash if `'true'`, Default is `'false'`
         
     | 
| 
      
 28 
     | 
    
         
            +
              - `api_environment`: Set as `'demo'` or `'production'`. Default is `'demo'`
         
     | 
| 
      
 29 
     | 
    
         
            +
              - `return_json`: Set as `'true'` or `'false'`. Default is `'false'` return ruby objects.
         
     | 
| 
      
 30 
     | 
    
         
            +
              - `hashify`: Set as `'true'` or `'false'`. Default is `'false'` return a hashed version of the json response if `return_json` is set to 'true'
         
     | 
| 
       32 
31 
     | 
    
         | 
| 
       33 
32 
     | 
    
         
             
            #### Config via Environment Variables
         
     | 
| 
       34 
33 
     | 
    
         | 
| 
       35 
34 
     | 
    
         
             
            You can set config settings by creating environment variables called:
         
     | 
| 
       36 
35 
     | 
    
         | 
| 
       37 
     | 
    
         
            -
            `ENV['ACCESS_TOKEN']`, `ENV[' 
     | 
| 
      
 36 
     | 
    
         
            +
            `ENV['ACCESS_TOKEN']`, `ENV['ACCESS_ENVIRONMENT']`, `ENV['ACCESS_RETURN_JSON']`, `ENV['ACCESS_HASHIFY']`
         
     | 
| 
       38 
37 
     | 
    
         | 
| 
       39 
38 
     | 
    
         
             
            #### Config via Initializer
         
     | 
| 
       40 
39 
     | 
    
         | 
| 
         @@ -43,88 +42,218 @@ You can also create an initializer file to set up a config 
     | 
|
| 
       43 
42 
     | 
    
         
             
            ```ruby
         
     | 
| 
       44 
43 
     | 
    
         
             
            Access.configure do |config|
         
     | 
| 
       45 
44 
     | 
    
         
             
              config.access_token = ENV['ACCESS_TOKEN']
         
     | 
| 
       46 
     | 
    
         
            -
              config.hashify = 'true'
         
     | 
| 
       47 
45 
     | 
    
         
             
            end
         
     | 
| 
       48 
46 
     | 
    
         
             
            ```
         
     | 
| 
       49 
47 
     | 
    
         | 
| 
       50 
48 
     | 
    
         
             
            You can also set them one at a time
         
     | 
| 
       51 
49 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
            `Access.config. 
     | 
| 
      
 50 
     | 
    
         
            +
            `Access.config.access_token = ENV['ACCESS_TOKEN']`
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            ### Config via Params
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            `return_json` can be overwritten by passing in by passing the param `return_json` to the end of any call that accepts options.
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            `hashify` can be overwritten by passing in by passing the param `hashify` to the end of any call that accepts options.
         
     | 
| 
       53 
57 
     | 
    
         | 
| 
       54 
58 
     | 
    
         
             
            ###Making Calls
         
     | 
| 
       55 
59 
     | 
    
         | 
| 
       56 
60 
     | 
    
         
             
            ####Offer
         
     | 
| 
       57 
61 
     | 
    
         | 
| 
       58 
62 
     | 
    
         
             
            ```ruby
         
     | 
| 
       59 
     | 
    
         
            -
            Access::Offer.search options
         
     | 
| 
      
 63 
     | 
    
         
            +
            Access::Offer.search options, member_key: **your-member-key**
         
     | 
| 
       60 
64 
     | 
    
         
             
            ```
         
     | 
| 
       61 
65 
     | 
    
         | 
| 
       62 
66 
     | 
    
         
             
            ```ruby
         
     | 
| 
       63 
     | 
    
         
            -
            Access::Offer.find **offer_key 
     | 
| 
      
 67 
     | 
    
         
            +
            Access::Offer.find **offer_key**, options, member_key: **your-member-key**
         
     | 
| 
       64 
68 
     | 
    
         
             
            ```
         
     | 
| 
       65 
69 
     | 
    
         | 
| 
       66 
70 
     | 
    
         
             
            ####Store
         
     | 
| 
       67 
71 
     | 
    
         | 
| 
       68 
72 
     | 
    
         
             
            ```ruby
         
     | 
| 
       69 
     | 
    
         
            -
            Access::Store.search options
         
     | 
| 
      
 73 
     | 
    
         
            +
            Access::Store.search options, member_key: **your-member-key**
         
     | 
| 
       70 
74 
     | 
    
         
             
            ```
         
     | 
| 
       71 
75 
     | 
    
         | 
| 
       72 
76 
     | 
    
         
             
            ```ruby
         
     | 
| 
       73 
     | 
    
         
            -
            Access::Store.find store_key options
         
     | 
| 
      
 77 
     | 
    
         
            +
            Access::Store.find **store_key**, options, member_key: **your-member-key**
         
     | 
| 
      
 78 
     | 
    
         
            +
            ```
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 81 
     | 
    
         
            +
            Access::Store.national options, member_key: **your-member-key**
         
     | 
| 
       74 
82 
     | 
    
         
             
            ```
         
     | 
| 
       75 
83 
     | 
    
         | 
| 
       76 
84 
     | 
    
         
             
            ####Location
         
     | 
| 
       77 
85 
     | 
    
         | 
| 
       78 
86 
     | 
    
         
             
            ```ruby
         
     | 
| 
       79 
     | 
    
         
            -
            Access::Location.search options
         
     | 
| 
      
 87 
     | 
    
         
            +
            Access::Location.search options, member_key: **your-member-key**
         
     | 
| 
       80 
88 
     | 
    
         
             
            ```
         
     | 
| 
       81 
89 
     | 
    
         | 
| 
       82 
90 
     | 
    
         
             
            ```ruby
         
     | 
| 
       83 
     | 
    
         
            -
            Access::Location.find location_key options
         
     | 
| 
      
 91 
     | 
    
         
            +
            Access::Location.find **location_key**, options, member_key: **your-member-key**
         
     | 
| 
       84 
92 
     | 
    
         
             
            ```
         
     | 
| 
       85 
93 
     | 
    
         | 
| 
       86 
94 
     | 
    
         
             
            ####Category
         
     | 
| 
       87 
95 
     | 
    
         | 
| 
       88 
96 
     | 
    
         
             
            ```ruby
         
     | 
| 
       89 
     | 
    
         
            -
            Access::Category.search options
         
     | 
| 
      
 97 
     | 
    
         
            +
            Access::Category.search options, member_key: **your-member-key**
         
     | 
| 
      
 98 
     | 
    
         
            +
            ```
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 101 
     | 
    
         
            +
            Access::Category.find **category_key**, options, member_key: **your-member-key**
         
     | 
| 
      
 102 
     | 
    
         
            +
            ```
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
            ####Autocomplete
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 107 
     | 
    
         
            +
            Access::Autocomplete.search options
         
     | 
| 
      
 108 
     | 
    
         
            +
            ```
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 111 
     | 
    
         
            +
            Access::Autocomplete.search_stores options
         
     | 
| 
      
 112 
     | 
    
         
            +
            ```
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
      
 114 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 115 
     | 
    
         
            +
            Access::Autocomplete.search_categories options
         
     | 
| 
      
 116 
     | 
    
         
            +
            ```
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 119 
     | 
    
         
            +
            Access::Autocomplete.search_offers options
         
     | 
| 
      
 120 
     | 
    
         
            +
            ```
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
      
 122 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 123 
     | 
    
         
            +
            Access::Autocomplete.search_locations options
         
     | 
| 
      
 124 
     | 
    
         
            +
            ```
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
      
 126 
     | 
    
         
            +
            ####Redeem
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 129 
     | 
    
         
            +
            Access::Redeem.redeem_offer **key**, nil, options, member_key: **your-member-key**
         
     | 
| 
      
 130 
     | 
    
         
            +
            ```
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 133 
     | 
    
         
            +
            Access::Redeem.redeem_offer **offer_key**, **redeem_type**, options, member_key: **your-member-key**
         
     | 
| 
      
 134 
     | 
    
         
            +
            ```
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
            ####Member
         
     | 
| 
      
 137 
     | 
    
         
            +
             
     | 
| 
      
 138 
     | 
    
         
            +
            ####City Savings
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
      
 140 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 141 
     | 
    
         
            +
            Access::CitySavings.search_city_savings options, member_key: **your-member-key**
         
     | 
| 
      
 142 
     | 
    
         
            +
            ```
         
     | 
| 
      
 143 
     | 
    
         
            +
             
     | 
| 
      
 144 
     | 
    
         
            +
            ####Channel
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 147 
     | 
    
         
            +
            Access::Channel.search options
         
     | 
| 
      
 148 
     | 
    
         
            +
            ```
         
     | 
| 
      
 149 
     | 
    
         
            +
             
     | 
| 
      
 150 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 151 
     | 
    
         
            +
            Access::Channel.find **channel_key**, options
         
     | 
| 
      
 152 
     | 
    
         
            +
            ```
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
            ####Campaign
         
     | 
| 
      
 155 
     | 
    
         
            +
             
     | 
| 
      
 156 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 157 
     | 
    
         
            +
            Access::Campaign.search options
         
     | 
| 
       90 
158 
     | 
    
         
             
            ```
         
     | 
| 
       91 
159 
     | 
    
         | 
| 
       92 
160 
     | 
    
         
             
            ```ruby
         
     | 
| 
       93 
     | 
    
         
            -
            Access:: 
     | 
| 
      
 161 
     | 
    
         
            +
            Access::Campaign.find **campaign_key**, options
         
     | 
| 
      
 162 
     | 
    
         
            +
            ```
         
     | 
| 
      
 163 
     | 
    
         
            +
             
     | 
| 
      
 164 
     | 
    
         
            +
            ###Spot
         
     | 
| 
      
 165 
     | 
    
         
            +
             
     | 
| 
      
 166 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 167 
     | 
    
         
            +
            Access::Spot.search_by_channel **channel_key**, options
         
     | 
| 
      
 168 
     | 
    
         
            +
            ```
         
     | 
| 
      
 169 
     | 
    
         
            +
             
     | 
| 
      
 170 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 171 
     | 
    
         
            +
            Access::Spot.search_by_campaign **campaign_key**, options
         
     | 
| 
      
 172 
     | 
    
         
            +
            ```
         
     | 
| 
      
 173 
     | 
    
         
            +
             
     | 
| 
      
 174 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 175 
     | 
    
         
            +
            Access::Spot.find **spot_key**, options
         
     | 
| 
      
 176 
     | 
    
         
            +
            ```
         
     | 
| 
      
 177 
     | 
    
         
            +
             
     | 
| 
      
 178 
     | 
    
         
            +
            ###Internal Admin only Calls
         
     | 
| 
      
 179 
     | 
    
         
            +
             
     | 
| 
      
 180 
     | 
    
         
            +
            ###Filter
         
     | 
| 
      
 181 
     | 
    
         
            +
             
     | 
| 
      
 182 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 183 
     | 
    
         
            +
            Access::Filter.search options
         
     | 
| 
      
 184 
     | 
    
         
            +
            ```
         
     | 
| 
      
 185 
     | 
    
         
            +
             
     | 
| 
      
 186 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 187 
     | 
    
         
            +
            Access::Filter.find **filter_key**, options
         
     | 
| 
       94 
188 
     | 
    
         
             
            ```
         
     | 
| 
       95 
189 
     | 
    
         | 
| 
       96 
190 
     | 
    
         
             
            ####Report
         
     | 
| 
       97 
191 
     | 
    
         | 
| 
      
 192 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 193 
     | 
    
         
            +
            Access::Report.all_usage options
         
     | 
| 
      
 194 
     | 
    
         
            +
            ```
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
       98 
196 
     | 
    
         
             
            ```ruby
         
     | 
| 
       99 
197 
     | 
    
         
             
            Access::Report.usage options
         
     | 
| 
       100 
198 
     | 
    
         
             
            ```
         
     | 
| 
       101 
199 
     | 
    
         | 
| 
       102 
200 
     | 
    
         
             
            ```ruby
         
     | 
| 
       103 
     | 
    
         
            -
            Access::Report. 
     | 
| 
      
 201 
     | 
    
         
            +
            Access::Report.usage_other **token**, options
         
     | 
| 
       104 
202 
     | 
    
         
             
            ```
         
     | 
| 
       105 
203 
     | 
    
         | 
| 
       106 
204 
     | 
    
         
             
            ####Token
         
     | 
| 
       107 
205 
     | 
    
         | 
| 
       108 
206 
     | 
    
         
             
            ```ruby
         
     | 
| 
       109 
     | 
    
         
            -
            Access::Token. 
     | 
| 
      
 207 
     | 
    
         
            +
            Access::Token.search options
         
     | 
| 
       110 
208 
     | 
    
         
             
            ```
         
     | 
| 
       111 
209 
     | 
    
         | 
| 
       112 
210 
     | 
    
         
             
            ```ruby
         
     | 
| 
       113 
     | 
    
         
            -
            Access::Token. 
     | 
| 
      
 211 
     | 
    
         
            +
            Access::Token.find **token**, options
         
     | 
| 
       114 
212 
     | 
    
         
             
            ```
         
     | 
| 
       115 
213 
     | 
    
         | 
| 
       116 
     | 
    
         
            -
            #### 
     | 
| 
      
 214 
     | 
    
         
            +
            ####Oauth Application
         
     | 
| 
       117 
215 
     | 
    
         | 
| 
       118 
216 
     | 
    
         
             
            ```ruby
         
     | 
| 
       119 
     | 
    
         
            -
            Access:: 
     | 
| 
      
 217 
     | 
    
         
            +
            Access::OauthApplication.search options
         
     | 
| 
       120 
218 
     | 
    
         
             
            ```
         
     | 
| 
       121 
219 
     | 
    
         | 
| 
       122 
220 
     | 
    
         
             
            ```ruby
         
     | 
| 
       123 
     | 
    
         
            -
            Access:: 
     | 
| 
      
 221 
     | 
    
         
            +
            Access::OauthApplication.find **application_id**, options
         
     | 
| 
       124 
222 
     | 
    
         
             
            ```
         
     | 
| 
       125 
223 
     | 
    
         | 
| 
       126 
     | 
    
         
            -
             
     | 
| 
      
 224 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 225 
     | 
    
         
            +
            Access::OauthApplication.search_tokens **application_id**, options
         
     | 
| 
      
 226 
     | 
    
         
            +
            ```
         
     | 
| 
      
 227 
     | 
    
         
            +
             
     | 
| 
      
 228 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 229 
     | 
    
         
            +
            Access::OauthApplication.find_token **application_id**, **token_id**, options
         
     | 
| 
      
 230 
     | 
    
         
            +
            ```
         
     | 
| 
      
 231 
     | 
    
         
            +
             
     | 
| 
      
 232 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 233 
     | 
    
         
            +
            Access::OauthApplication.create_token **application_id**, options
         
     | 
| 
      
 234 
     | 
    
         
            +
            ```
         
     | 
| 
      
 235 
     | 
    
         
            +
             
     | 
| 
      
 236 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 237 
     | 
    
         
            +
            Access::OauthApplication.create **application_id**, options
         
     | 
| 
      
 238 
     | 
    
         
            +
            ```
         
     | 
| 
      
 239 
     | 
    
         
            +
             
     | 
| 
      
 240 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 241 
     | 
    
         
            +
            Access::OauthApplication.update **application_id**, options
         
     | 
| 
      
 242 
     | 
    
         
            +
            ```
         
     | 
| 
      
 243 
     | 
    
         
            +
             
     | 
| 
      
 244 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 245 
     | 
    
         
            +
            Access::OauthApplication.delete **application_id**, options
         
     | 
| 
      
 246 
     | 
    
         
            +
            ```
         
     | 
| 
      
 247 
     | 
    
         
            +
             
     | 
| 
      
 248 
     | 
    
         
            +
            ####Verify
         
     | 
| 
      
 249 
     | 
    
         
            +
             
     | 
| 
      
 250 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 251 
     | 
    
         
            +
              Access::Verify.token options
         
     | 
| 
      
 252 
     | 
    
         
            +
            ```
         
     | 
| 
       127 
253 
     | 
    
         | 
| 
      
 254 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 255 
     | 
    
         
            +
              Access::Verify.filter options
         
     | 
| 
      
 256 
     | 
    
         
            +
            ```
         
     | 
| 
       128 
257 
     | 
    
         | 
| 
       129 
258 
     | 
    
         
             
            ## Contributing
         
     | 
| 
       130 
259 
     | 
    
         | 
| 
         @@ -134,5 +263,12 @@ Access::Redeem.redeem_offer key redeem_type options` *member_key required 
     | 
|
| 
       134 
263 
     | 
    
         
             
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
       135 
264 
     | 
    
         
             
            5. Create a new Pull Request
         
     | 
| 
       136 
265 
     | 
    
         | 
| 
      
 266 
     | 
    
         
            +
            ### Running the Tests
         
     | 
| 
      
 267 
     | 
    
         
            +
             
     | 
| 
      
 268 
     | 
    
         
            +
            `ACCESS_TOKEN=**your-access-token** rake`
         
     | 
| 
      
 269 
     | 
    
         
            +
             
     | 
| 
      
 270 
     | 
    
         
            +
            `ACCESS_TOKEN=*your-access-token** guard`
         
     | 
| 
       137 
271 
     | 
    
         | 
| 
      
 272 
     | 
    
         
            +
            ### Running the Gem in Console
         
     | 
| 
       138 
273 
     | 
    
         | 
| 
      
 274 
     | 
    
         
            +
            `ACCESS_TOKEN=*your-access-token** ruby bin/console`
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -1,2 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require "bundler/gem_tasks"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'rake/testtask'
         
     | 
| 
       2 
3 
     | 
    
         | 
| 
      
 4 
     | 
    
         
            +
            Rake::TestTask.new do |t|
         
     | 
| 
      
 5 
     | 
    
         
            +
              t.libs << "test"
         
     | 
| 
      
 6 
     | 
    
         
            +
              t.libs << "lib"
         
     | 
| 
      
 7 
     | 
    
         
            +
              t.test_files = FileList['test/**/*_test.rb']
         
     | 
| 
      
 8 
     | 
    
         
            +
              t.verbose = true
         
     | 
| 
      
 9 
     | 
    
         
            +
            end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            task default: :test
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            task :clear_vcr do
         
     | 
| 
      
 14 
     | 
    
         
            +
              `rm test/fixtures/*.yml`
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
    
        data/access.gemspec
    CHANGED
    
    | 
         @@ -24,7 +24,12 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       24 
24 
     | 
    
         
             
              spec.add_development_dependency "vcr"
         
     | 
| 
       25 
25 
     | 
    
         
             
              spec.add_development_dependency "webmock"
         
     | 
| 
       26 
26 
     | 
    
         
             
              spec.add_development_dependency "pry"
         
     | 
| 
      
 27 
     | 
    
         
            +
              spec.add_development_dependency "guard"
         
     | 
| 
      
 28 
     | 
    
         
            +
              spec.add_development_dependency "guard-minitest"
         
     | 
| 
      
 29 
     | 
    
         
            +
              spec.add_development_dependency "coveralls"
         
     | 
| 
      
 30 
     | 
    
         
            +
              spec.add_development_dependency "simplecov"
         
     | 
| 
      
 31 
     | 
    
         
            +
              spec.add_development_dependency "minitest-focus"
         
     | 
| 
       27 
32 
     | 
    
         | 
| 
       28 
     | 
    
         
            -
              spec.add_dependency "httparty", "~> 0.13.3"
         
     | 
| 
       29 
33 
     | 
    
         
             
              spec.add_dependency "hashie", "~> 3.3.1"
         
     | 
| 
      
 34 
     | 
    
         
            +
              spec.add_dependency "httparty", "~> 0.13.3"
         
     | 
| 
       30 
35 
     | 
    
         
             
            end
         
     | 
    
        data/bin/console
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "bundler/setup"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "access"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # You can add fixtures and/or initialization code here to make experimenting
         
     | 
| 
      
 7 
     | 
    
         
            +
            # with your gem easier. You can also use a different console, if you like.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # (If you use this, don't forget to add pry to your Gemfile!)
         
     | 
| 
      
 10 
     | 
    
         
            +
            require "pry"
         
     | 
| 
      
 11 
     | 
    
         
            +
            Pry.start
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            # require "irb"
         
     | 
| 
      
 14 
     | 
    
         
            +
            # IRB.start
         
     | 
    
        data/bin/setup
    ADDED
    
    
    
        data/lib/access.rb
    CHANGED
    
    | 
         @@ -2,23 +2,34 @@ require "rubygems" 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require "hashie"
         
     | 
| 
       3 
3 
     | 
    
         
             
            require "httparty"
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
            require "access/version"
         
     | 
| 
       6 
     | 
    
         
            -
            require "access/error"
         
     | 
| 
       7 
5 
     | 
    
         
             
            require "access/config"
         
     | 
| 
       8 
     | 
    
         
            -
            require "access/request"
         
     | 
| 
       9 
6 
     | 
    
         
             
            require "access/api"
         
     | 
| 
       10 
     | 
    
         
            -
            require "access/offer"
         
     | 
| 
       11 
     | 
    
         
            -
            require "access/store"
         
     | 
| 
       12 
     | 
    
         
            -
            require "access/location"
         
     | 
| 
       13 
     | 
    
         
            -
            require "access/category"
         
     | 
| 
       14 
7 
     | 
    
         
             
            require "access/autocomplete"
         
     | 
| 
       15 
     | 
    
         
            -
            require "access/ 
     | 
| 
      
 8 
     | 
    
         
            +
            require "access/campaign"
         
     | 
| 
      
 9 
     | 
    
         
            +
            require "access/category"
         
     | 
| 
      
 10 
     | 
    
         
            +
            require "access/channel"
         
     | 
| 
      
 11 
     | 
    
         
            +
            require "access/city_savings"
         
     | 
| 
      
 12 
     | 
    
         
            +
            require "access/error"
         
     | 
| 
       16 
13 
     | 
    
         
             
            require "access/filter"
         
     | 
| 
      
 14 
     | 
    
         
            +
            require "access/info"
         
     | 
| 
      
 15 
     | 
    
         
            +
            require "access/link"
         
     | 
| 
      
 16 
     | 
    
         
            +
            require "access/location"
         
     | 
| 
      
 17 
     | 
    
         
            +
            require "access/member"
         
     | 
| 
       17 
18 
     | 
    
         
             
            require "access/oauth_application"
         
     | 
| 
      
 19 
     | 
    
         
            +
            require "access/offer"
         
     | 
| 
      
 20 
     | 
    
         
            +
            require "access/redeem"
         
     | 
| 
      
 21 
     | 
    
         
            +
            require "access/report"
         
     | 
| 
      
 22 
     | 
    
         
            +
            require "access/request"
         
     | 
| 
      
 23 
     | 
    
         
            +
            require "access/response"
         
     | 
| 
      
 24 
     | 
    
         
            +
            require "access/spot"
         
     | 
| 
      
 25 
     | 
    
         
            +
            require "access/store"
         
     | 
| 
       18 
26 
     | 
    
         
             
            require "access/token"
         
     | 
| 
       19 
27 
     | 
    
         
             
            require "access/verify"
         
     | 
| 
       20 
     | 
    
         
            -
            require "access/ 
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 28 
     | 
    
         
            +
            require "access/version"
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            module Access
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
| 
       22 
33 
     | 
    
         | 
| 
       23 
34 
     | 
    
         
             
            HTTParty::Response.class_eval do
         
     | 
| 
       24 
35 
     | 
    
         
             
              def hashify
         
     | 
    
        data/lib/access/api.rb
    CHANGED
    
    | 
         @@ -1,145 +1,269 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Access
         
     | 
| 
       2 
     | 
    
         
            -
              class Api 
     | 
| 
      
 2 
     | 
    
         
            +
              class Api
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
                # Categories
         
     | 
| 
       5 
5 
     | 
    
         
             
                def search_categories(options = {})
         
     | 
| 
       6 
     | 
    
         
            -
                  get("/categories", "offer", options)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  request.get("/categories", "offer", options) do |response|
         
     | 
| 
      
 7 
     | 
    
         
            +
                    CategoryResponse.new(response)
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
       7 
9 
     | 
    
         
             
                end
         
     | 
| 
       8 
10 
     | 
    
         | 
| 
       9 
     | 
    
         
            -
                def find_category( 
     | 
| 
       10 
     | 
    
         
            -
                  get("/categories/#{ 
     | 
| 
      
 11 
     | 
    
         
            +
                def find_category(category_key, options = {})
         
     | 
| 
      
 12 
     | 
    
         
            +
                  request.get("/categories/#{category_key}", "offer", options) do |response|
         
     | 
| 
      
 13 
     | 
    
         
            +
                    CategoryResponse.new(response)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
       11 
15 
     | 
    
         
             
                end
         
     | 
| 
       12 
16 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
17 
     | 
    
         
             
                # Offers
         
     | 
| 
       15 
     | 
    
         
            -
                def search_offers(options={})
         
     | 
| 
       16 
     | 
    
         
            -
                  get("/offers", "offer", options)
         
     | 
| 
      
 18 
     | 
    
         
            +
                def search_offers(options = {})
         
     | 
| 
      
 19 
     | 
    
         
            +
                  request.get("/offers", "offer", options) do |response|
         
     | 
| 
      
 20 
     | 
    
         
            +
                    OfferResponse.new(response)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
       17 
22 
     | 
    
         
             
                end
         
     | 
| 
       18 
23 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
                def find_offer( 
     | 
| 
       20 
     | 
    
         
            -
                  get("/offers/#{ 
     | 
| 
      
 24 
     | 
    
         
            +
                def find_offer(offer_key, options = {})
         
     | 
| 
      
 25 
     | 
    
         
            +
                  request.get("/offers/#{offer_key}", "offer", options) do |response|
         
     | 
| 
      
 26 
     | 
    
         
            +
                    OfferResponse.new(response)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
       21 
28 
     | 
    
         
             
                end
         
     | 
| 
       22 
29 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
30 
     | 
    
         
             
                # Locations
         
     | 
| 
       25 
     | 
    
         
            -
                def search_locations(options={})
         
     | 
| 
       26 
     | 
    
         
            -
                  get("/locations", "offer", options)
         
     | 
| 
      
 31 
     | 
    
         
            +
                def search_locations(options = {})
         
     | 
| 
      
 32 
     | 
    
         
            +
                  request.get("/locations", "offer", options) do |response|
         
     | 
| 
      
 33 
     | 
    
         
            +
                    LocationResponse.new(response)
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
       27 
35 
     | 
    
         
             
                end
         
     | 
| 
       28 
36 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                def find_location( 
     | 
| 
       30 
     | 
    
         
            -
                  get("/locations/#{ 
     | 
| 
      
 37 
     | 
    
         
            +
                def find_location(location_key, options = {})
         
     | 
| 
      
 38 
     | 
    
         
            +
                  request.get("/locations/#{location_key}", "offer", options) do |response|
         
     | 
| 
      
 39 
     | 
    
         
            +
                    LocationResponse.new(response)
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
       31 
41 
     | 
    
         
             
                end
         
     | 
| 
       32 
42 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
43 
     | 
    
         
             
                # Stores
         
     | 
| 
       35 
     | 
    
         
            -
                def search_stores(options={})
         
     | 
| 
       36 
     | 
    
         
            -
                  get("/stores", "offer", options)
         
     | 
| 
      
 44 
     | 
    
         
            +
                def search_stores(options = {})
         
     | 
| 
      
 45 
     | 
    
         
            +
                  request.get("/stores", "offer", options) do |response|
         
     | 
| 
      
 46 
     | 
    
         
            +
                    StoreResponse.new(response)
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end
         
     | 
| 
       37 
48 
     | 
    
         
             
                end
         
     | 
| 
       38 
49 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
                def find_store( 
     | 
| 
       40 
     | 
    
         
            -
                  get("/stores/#{ 
     | 
| 
      
 50 
     | 
    
         
            +
                def find_store(store_key, options = {})
         
     | 
| 
      
 51 
     | 
    
         
            +
                  request.get("/stores/#{store_key}", "offer", options) do |response|
         
     | 
| 
      
 52 
     | 
    
         
            +
                    StoreResponse.new(response)
         
     | 
| 
      
 53 
     | 
    
         
            +
                  end
         
     | 
| 
       41 
54 
     | 
    
         
             
                end
         
     | 
| 
       42 
55 
     | 
    
         | 
| 
       43 
56 
     | 
    
         
             
                def national_stores(options={})
         
     | 
| 
       44 
     | 
    
         
            -
                  get("/stores/national", "offer", options)
         
     | 
| 
      
 57 
     | 
    
         
            +
                  request.get("/stores/national", "offer", options) do |response|
         
     | 
| 
      
 58 
     | 
    
         
            +
                    StoreResponse.new(response)
         
     | 
| 
      
 59 
     | 
    
         
            +
                  end
         
     | 
| 
       45 
60 
     | 
    
         
             
                end
         
     | 
| 
       46 
61 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
62 
     | 
    
         
             
                # Autocomplete
         
     | 
| 
       49 
63 
     | 
    
         
             
                def autocomplete(options = {})
         
     | 
| 
       50 
     | 
    
         
            -
                  get("/autocomplete", "offer", options)
         
     | 
| 
      
 64 
     | 
    
         
            +
                  request.get("/autocomplete", "offer", options) do |response|
         
     | 
| 
      
 65 
     | 
    
         
            +
                    AutocompleteResponse.new(response)
         
     | 
| 
      
 66 
     | 
    
         
            +
                  end
         
     | 
| 
       51 
67 
     | 
    
         
             
                end
         
     | 
| 
       52 
68 
     | 
    
         | 
| 
      
 69 
     | 
    
         
            +
                # Redeem
         
     | 
| 
      
 70 
     | 
    
         
            +
                def redeem_offer(offer_key, redeem_type = nil, options = {})
         
     | 
| 
      
 71 
     | 
    
         
            +
                  request.get("/redeem/#{offer_key}/#{redeem_type}", "redeem", options) do |response|
         
     | 
| 
      
 72 
     | 
    
         
            +
                    RedeemResponse.new(response)
         
     | 
| 
      
 73 
     | 
    
         
            +
                  end
         
     | 
| 
      
 74 
     | 
    
         
            +
                end
         
     | 
| 
       53 
75 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
                #  
     | 
| 
       55 
     | 
    
         
            -
                def  
     | 
| 
       56 
     | 
    
         
            -
                   
     | 
| 
      
 76 
     | 
    
         
            +
                # CitySavings
         
     | 
| 
      
 77 
     | 
    
         
            +
                def search_city_savings(options = {})
         
     | 
| 
      
 78 
     | 
    
         
            +
                  # this is broken
         
     | 
| 
      
 79 
     | 
    
         
            +
                  request.get("/citysavings", "allcitysavings", options) do |response|
         
     | 
| 
      
 80 
     | 
    
         
            +
                    CitySavingsResponse.new(response)
         
     | 
| 
      
 81 
     | 
    
         
            +
                  end
         
     | 
| 
      
 82 
     | 
    
         
            +
                end
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                # Channel
         
     | 
| 
      
 85 
     | 
    
         
            +
                def search_channels(options = {})
         
     | 
| 
      
 86 
     | 
    
         
            +
                  request.get("/channels", "campaign", options) do |response|
         
     | 
| 
      
 87 
     | 
    
         
            +
                    ChannelResponse.new(response)
         
     | 
| 
      
 88 
     | 
    
         
            +
                  end
         
     | 
| 
       57 
89 
     | 
    
         
             
                end
         
     | 
| 
       58 
90 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                def  
     | 
| 
       60 
     | 
    
         
            -
                  get("/ 
     | 
| 
      
 91 
     | 
    
         
            +
                def find_channel(channel_key, options = {})
         
     | 
| 
      
 92 
     | 
    
         
            +
                  request.get("/channels/#{channel_key}", "campaign", options) do |response|
         
     | 
| 
      
 93 
     | 
    
         
            +
                    ChannelResponse.new(response)
         
     | 
| 
      
 94 
     | 
    
         
            +
                  end
         
     | 
| 
       61 
95 
     | 
    
         
             
                end
         
     | 
| 
       62 
96 
     | 
    
         | 
| 
      
 97 
     | 
    
         
            +
                # Campaign
         
     | 
| 
      
 98 
     | 
    
         
            +
                def search_campaigns(options = {})
         
     | 
| 
      
 99 
     | 
    
         
            +
                  request.get("/campaigns", "campaign", options) do |response|
         
     | 
| 
      
 100 
     | 
    
         
            +
                    ChampaignResponse.new(response)
         
     | 
| 
      
 101 
     | 
    
         
            +
                  end
         
     | 
| 
      
 102 
     | 
    
         
            +
                end
         
     | 
| 
       63 
103 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
                 
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
      
 104 
     | 
    
         
            +
                def find_campaign(campaign_key, options = {})
         
     | 
| 
      
 105 
     | 
    
         
            +
                  request.get("/campaigns/#{store_key}", "campaign", options) do |response|
         
     | 
| 
      
 106 
     | 
    
         
            +
                    ChampaignResponse.new(response)
         
     | 
| 
      
 107 
     | 
    
         
            +
                  end
         
     | 
| 
       67 
108 
     | 
    
         
             
                end
         
     | 
| 
       68 
109 
     | 
    
         | 
| 
       69 
     | 
    
         
            -
                 
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
      
 110 
     | 
    
         
            +
                # Spot
         
     | 
| 
      
 111 
     | 
    
         
            +
                def search_spots_by_channel(channel_key, options = {})
         
     | 
| 
      
 112 
     | 
    
         
            +
                  request.get("/spots/channel/#{channel_key}", "campaign", options) do |response|
         
     | 
| 
      
 113 
     | 
    
         
            +
                    SpotResponse.new(response)
         
     | 
| 
      
 114 
     | 
    
         
            +
                  end
         
     | 
| 
       71 
115 
     | 
    
         
             
                end
         
     | 
| 
       72 
116 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
                def  
     | 
| 
       74 
     | 
    
         
            -
                  get("/ 
     | 
| 
      
 117 
     | 
    
         
            +
                def search_spots_by_campaign(campaign_key, options = {})
         
     | 
| 
      
 118 
     | 
    
         
            +
                  request.get("/spots/campaign/#{campaign_key}", "campaign", options) do |response|
         
     | 
| 
      
 119 
     | 
    
         
            +
                    SpotResponse.new(response)
         
     | 
| 
      
 120 
     | 
    
         
            +
                  end
         
     | 
| 
       75 
121 
     | 
    
         
             
                end
         
     | 
| 
       76 
122 
     | 
    
         | 
| 
       77 
     | 
    
         
            -
                def  
     | 
| 
       78 
     | 
    
         
            -
                  get("/ 
     | 
| 
      
 123 
     | 
    
         
            +
                def find_spot(spot_key, options = {})
         
     | 
| 
      
 124 
     | 
    
         
            +
                  request.get("/spots/#{spot_key}", "campaign", options) do |response|
         
     | 
| 
      
 125 
     | 
    
         
            +
                    SpotResponse.new(response)
         
     | 
| 
      
 126 
     | 
    
         
            +
                  end
         
     | 
| 
       79 
127 
     | 
    
         
             
                end
         
     | 
| 
       80 
128 
     | 
    
         | 
| 
       81 
     | 
    
         
            -
                 
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
      
 129 
     | 
    
         
            +
                # Member
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
      
 131 
     | 
    
         
            +
                # Internal Admin only Call Below
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
                # Filters
         
     | 
| 
      
 134 
     | 
    
         
            +
                def search_filters(options = {})
         
     | 
| 
      
 135 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 136 
     | 
    
         
            +
                  request.get("/filters", "token", options) do |response|
         
     | 
| 
      
 137 
     | 
    
         
            +
                    FilterResponse.new(response)
         
     | 
| 
      
 138 
     | 
    
         
            +
                  end
         
     | 
| 
       83 
139 
     | 
    
         
             
                end
         
     | 
| 
       84 
140 
     | 
    
         | 
| 
       85 
     | 
    
         
            -
                def  
     | 
| 
       86 
     | 
    
         
            -
                   
     | 
| 
      
 141 
     | 
    
         
            +
                def find_filter(application_key, options = {})
         
     | 
| 
      
 142 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 143 
     | 
    
         
            +
                  request.get("/filters/#{application_key}", "token", options) do |response|
         
     | 
| 
      
 144 
     | 
    
         
            +
                    FilterResponse.new(response)
         
     | 
| 
      
 145 
     | 
    
         
            +
                  end
         
     | 
| 
       87 
146 
     | 
    
         
             
                end
         
     | 
| 
       88 
147 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
                 
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
      
 148 
     | 
    
         
            +
                # Oauth Applications
         
     | 
| 
      
 149 
     | 
    
         
            +
                def search_oauth_applications(options = {})
         
     | 
| 
      
 150 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 151 
     | 
    
         
            +
                  request.get("/oauth_applications", 'token', options) do |response|
         
     | 
| 
      
 152 
     | 
    
         
            +
                    OauthApplicationResponse.new(response)
         
     | 
| 
      
 153 
     | 
    
         
            +
                  end
         
     | 
| 
       91 
154 
     | 
    
         
             
                end
         
     | 
| 
       92 
155 
     | 
    
         | 
| 
       93 
     | 
    
         
            -
                def  
     | 
| 
       94 
     | 
    
         
            -
                   
     | 
| 
      
 156 
     | 
    
         
            +
                def find_oauth_application(application_key, options = {})
         
     | 
| 
      
 157 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 158 
     | 
    
         
            +
                  request.get("/oauth_applications/#{application_key}", 'token', options) do |response|
         
     | 
| 
      
 159 
     | 
    
         
            +
                    OauthApplicationResponse.new(response)
         
     | 
| 
      
 160 
     | 
    
         
            +
                  end
         
     | 
| 
       95 
161 
     | 
    
         
             
                end
         
     | 
| 
       96 
162 
     | 
    
         | 
| 
      
 163 
     | 
    
         
            +
                def search_oauth_application_tokens(application_key, options = {})
         
     | 
| 
      
 164 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 165 
     | 
    
         
            +
                  request.get("/oauth_applications/#{application_key}/access_tokens", 'token', options) do |response|
         
     | 
| 
      
 166 
     | 
    
         
            +
                    TokenResponse.new(response)
         
     | 
| 
      
 167 
     | 
    
         
            +
                  end
         
     | 
| 
      
 168 
     | 
    
         
            +
                end
         
     | 
| 
       97 
169 
     | 
    
         | 
| 
       98 
     | 
    
         
            -
                 
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
                  get( 
     | 
| 
      
 170 
     | 
    
         
            +
                def find_oauth_application_token(application_key, token_key, options = {})
         
     | 
| 
      
 171 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 172 
     | 
    
         
            +
                  request.get("/oauth_applications/#{application_key}/access_tokens/#{token_key}", 'token', options) do |response|
         
     | 
| 
      
 173 
     | 
    
         
            +
                    TokenResponse.new(response)
         
     | 
| 
      
 174 
     | 
    
         
            +
                  end
         
     | 
| 
       101 
175 
     | 
    
         
             
                end
         
     | 
| 
       102 
176 
     | 
    
         | 
| 
       103 
     | 
    
         
            -
                def  
     | 
| 
       104 
     | 
    
         
            -
                   
     | 
| 
      
 177 
     | 
    
         
            +
                def create_oauth_application_token(application_key, options = {})
         
     | 
| 
      
 178 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 179 
     | 
    
         
            +
                  request.create("/oauth_applications/#{application_key}/access_tokens", 'token', options) do |response|
         
     | 
| 
      
 180 
     | 
    
         
            +
                    # TokenResponse.new(response)
         
     | 
| 
      
 181 
     | 
    
         
            +
                    # OauthApplicationResponse.new(response)
         
     | 
| 
      
 182 
     | 
    
         
            +
                  end
         
     | 
| 
      
 183 
     | 
    
         
            +
                  # create("/oauth_applications/#{application_key}/access_tokens", 'token', options)
         
     | 
| 
       105 
184 
     | 
    
         
             
                end
         
     | 
| 
       106 
185 
     | 
    
         | 
| 
      
 186 
     | 
    
         
            +
                def create_oauth_application(options = {})
         
     | 
| 
      
 187 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 188 
     | 
    
         
            +
                  request.create("/oauth_applications", 'token', options) do |response|
         
     | 
| 
      
 189 
     | 
    
         
            +
                    OauthApplicationResponse.new(response)
         
     | 
| 
      
 190 
     | 
    
         
            +
                  end
         
     | 
| 
      
 191 
     | 
    
         
            +
                  # create("/oauth_applications", 'token', options)
         
     | 
| 
      
 192 
     | 
    
         
            +
                end
         
     | 
| 
       107 
193 
     | 
    
         | 
| 
       108 
     | 
    
         
            -
                 
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
                   
     | 
| 
      
 194 
     | 
    
         
            +
                def update_oauth_application(application_key, batch= {})
         
     | 
| 
      
 195 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 196 
     | 
    
         
            +
                  request.put("/oauth_applications/#{application_key}", 'token', options) do |response|
         
     | 
| 
      
 197 
     | 
    
         
            +
                    OauthApplicationResponse.new(response)
         
     | 
| 
      
 198 
     | 
    
         
            +
                  end
         
     | 
| 
      
 199 
     | 
    
         
            +
                  # put("/oauth_applications/#{application_key}", 'token', options)
         
     | 
| 
       111 
200 
     | 
    
         
             
                end
         
     | 
| 
       112 
201 
     | 
    
         | 
| 
       113 
     | 
    
         
            -
                def  
     | 
| 
       114 
     | 
    
         
            -
                   
     | 
| 
      
 202 
     | 
    
         
            +
                def delete_oauth_application(application_key, options = {})
         
     | 
| 
      
 203 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 204 
     | 
    
         
            +
                  request.delete("/oauth_applications/#{application_key}", 'token', options) do |response|
         
     | 
| 
      
 205 
     | 
    
         
            +
                    OauthApplication.new(response)
         
     | 
| 
      
 206 
     | 
    
         
            +
                  end
         
     | 
| 
      
 207 
     | 
    
         
            +
                  # delete("/oauth_applications/#{application_key}", 'token', options)
         
     | 
| 
       115 
208 
     | 
    
         
             
                end
         
     | 
| 
       116 
209 
     | 
    
         | 
| 
      
 210 
     | 
    
         
            +
                # Access Tokens
         
     | 
| 
      
 211 
     | 
    
         
            +
                def search_tokens(options = {})
         
     | 
| 
      
 212 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 213 
     | 
    
         
            +
                  request.get("/tokens", 'token', options) do |response|
         
     | 
| 
      
 214 
     | 
    
         
            +
                    TokenResponse.new(response)
         
     | 
| 
      
 215 
     | 
    
         
            +
                  end
         
     | 
| 
      
 216 
     | 
    
         
            +
                end
         
     | 
| 
       117 
217 
     | 
    
         | 
| 
       118 
     | 
    
         
            -
                 
     | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
                   
     | 
| 
      
 218 
     | 
    
         
            +
                def find_token(token, options = {})
         
     | 
| 
      
 219 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 220 
     | 
    
         
            +
                  # new verify_other
         
     | 
| 
      
 221 
     | 
    
         
            +
                  request.get("/tokens/#{token}", "token", options) do |response|
         
     | 
| 
      
 222 
     | 
    
         
            +
                    TokenResponse.new(response)
         
     | 
| 
      
 223 
     | 
    
         
            +
                  end
         
     | 
| 
       121 
224 
     | 
    
         
             
                end
         
     | 
| 
       122 
225 
     | 
    
         | 
| 
       123 
     | 
    
         
            -
                 
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
      
 226 
     | 
    
         
            +
                # Verify
         
     | 
| 
      
 227 
     | 
    
         
            +
                def verify_token(options = {})
         
     | 
| 
      
 228 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 229 
     | 
    
         
            +
                  request.get("/verify", 'token', options) do |response|
         
     | 
| 
      
 230 
     | 
    
         
            +
                    VerifyResponse.new(response)
         
     | 
| 
      
 231 
     | 
    
         
            +
                  end
         
     | 
| 
       125 
232 
     | 
    
         
             
                end
         
     | 
| 
       126 
233 
     | 
    
         | 
| 
      
 234 
     | 
    
         
            +
                def verify_filter(filter, options = {})
         
     | 
| 
      
 235 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 236 
     | 
    
         
            +
                  request.get_for_filter("/filter", 'token', filter, options) do |response|
         
     | 
| 
      
 237 
     | 
    
         
            +
                    VerifyResponse.new(response)
         
     | 
| 
      
 238 
     | 
    
         
            +
                  end
         
     | 
| 
      
 239 
     | 
    
         
            +
                end
         
     | 
| 
       127 
240 
     | 
    
         | 
| 
       128 
241 
     | 
    
         
             
                # Report
         
     | 
| 
       129 
242 
     | 
    
         
             
                def all_usage(options = {})
         
     | 
| 
       130 
     | 
    
         
            -
                   
     | 
| 
      
 243 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 244 
     | 
    
         
            +
                  request.get("/all_usage", "report", options) do |response|
         
     | 
| 
      
 245 
     | 
    
         
            +
                    ReportResponse.new(response)
         
     | 
| 
      
 246 
     | 
    
         
            +
                  end
         
     | 
| 
       131 
247 
     | 
    
         
             
                end
         
     | 
| 
       132 
248 
     | 
    
         | 
| 
       133 
249 
     | 
    
         
             
                def usage(options = {})
         
     | 
| 
       134 
     | 
    
         
            -
                   
     | 
| 
      
 250 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 251 
     | 
    
         
            +
                  request.get("/usage", "report", options) do |response|
         
     | 
| 
      
 252 
     | 
    
         
            +
                    ReportResponse.new(response)
         
     | 
| 
      
 253 
     | 
    
         
            +
                  end
         
     | 
| 
       135 
254 
     | 
    
         
             
                end
         
     | 
| 
       136 
255 
     | 
    
         | 
| 
       137 
256 
     | 
    
         
             
                def usage_other(token, options = {})
         
     | 
| 
       138 
     | 
    
         
            -
                   
     | 
| 
      
 257 
     | 
    
         
            +
                  # Internal Admin only Call
         
     | 
| 
      
 258 
     | 
    
         
            +
                  request.get("/usage/#{token}", "report", options) do |response|
         
     | 
| 
      
 259 
     | 
    
         
            +
                    ReportResponse.new(response)
         
     | 
| 
      
 260 
     | 
    
         
            +
                  end
         
     | 
| 
       139 
261 
     | 
    
         
             
                end
         
     | 
| 
       140 
262 
     | 
    
         | 
| 
      
 263 
     | 
    
         
            +
                private
         
     | 
| 
       141 
264 
     | 
    
         | 
| 
       142 
     | 
    
         
            -
                 
     | 
| 
       143 
     | 
    
         
            -
             
     | 
| 
      
 265 
     | 
    
         
            +
                def request
         
     | 
| 
      
 266 
     | 
    
         
            +
                  Access::Request.new
         
     | 
| 
      
 267 
     | 
    
         
            +
                end
         
     | 
| 
       144 
268 
     | 
    
         
             
              end
         
     | 
| 
       145 
269 
     | 
    
         
             
            end
         
     |