access 1.1.7 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +2 -0
  4. data/.travis.yml +12 -0
  5. data/Guardfile +7 -0
  6. data/README.md +159 -23
  7. data/Rakefile +13 -0
  8. data/access.gemspec +6 -1
  9. data/bin/console +14 -0
  10. data/bin/setup +7 -0
  11. data/lib/access.rb +21 -10
  12. data/lib/access/api.rb +188 -64
  13. data/lib/access/autocomplete.rb +11 -0
  14. data/lib/access/campaign.rb +24 -0
  15. data/lib/access/category.rb +16 -2
  16. data/lib/access/channel.rb +24 -0
  17. data/lib/access/city_savings.rb +16 -0
  18. data/lib/access/config.rb +8 -7
  19. data/lib/access/error.rb +8 -2
  20. data/lib/access/filter.rb +30 -2
  21. data/lib/access/info.rb +13 -0
  22. data/lib/access/link.rb +17 -0
  23. data/lib/access/location.rb +17 -2
  24. data/lib/access/member.rb +11 -0
  25. data/lib/access/oauth_application.rb +31 -0
  26. data/lib/access/offer.rb +24 -20
  27. data/lib/access/redeem.rb +11 -4
  28. data/lib/access/report.rb +10 -0
  29. data/lib/access/request.rb +25 -20
  30. data/lib/access/response.rb +127 -0
  31. data/lib/access/spot.rb +28 -0
  32. data/lib/access/store.rb +16 -2
  33. data/lib/access/token.rb +18 -0
  34. data/lib/access/verify.rb +11 -2
  35. data/lib/access/version.rb +1 -1
  36. data/test/access/autocomplete_test.rb +53 -0
  37. data/test/access/category_test.rb +64 -0
  38. data/test/access/city_savings_test.rb +5 -0
  39. data/test/access/filter_test.rb +40 -0
  40. data/test/access/location_test.rb +59 -0
  41. data/test/access/member_test.rb +5 -0
  42. data/test/access/oauth_application_test.rb +91 -0
  43. data/test/access/offer_test.rb +71 -0
  44. data/test/access/redeem_test.rb +38 -0
  45. data/test/access/report_test.rb +36 -0
  46. data/test/access/store_test.rb +65 -0
  47. data/test/access/token_test.rb +35 -0
  48. data/test/access/verify_test.rb +29 -0
  49. data/test/access/version_test.rb +9 -0
  50. data/test/fixtures/autocomplete_search.yml +207 -0
  51. data/test/fixtures/autocomplete_search_categories.yml +181 -0
  52. data/test/fixtures/autocomplete_search_locations.yml +173 -0
  53. data/test/fixtures/autocomplete_search_offers.yml +181 -0
  54. data/test/fixtures/autocomplete_search_stores.yml +185 -0
  55. data/test/fixtures/category_find.yml +303 -0
  56. data/test/fixtures/category_search.yml +683 -0
  57. data/test/fixtures/category_search_fail_member_key.yml +102 -0
  58. data/test/fixtures/filter_find.yml +70 -0
  59. data/test/fixtures/filter_search.yml +195 -0
  60. data/test/fixtures/location_find.yml +923 -0
  61. data/test/fixtures/location_search.yml +378 -0
  62. data/test/fixtures/location_search_fail_member_key.yml +367 -0
  63. data/test/fixtures/national_stores.yml +4135 -0
  64. data/test/fixtures/oauth_application_find.yml +163 -0
  65. data/test/fixtures/oauth_application_search.yml +134 -0
  66. data/test/fixtures/oauth_application_search_fail_member_key.yml +268 -0
  67. data/test/fixtures/oauth_application_token_find.yml +249 -0
  68. data/test/fixtures/oauth_application_token_search.yml +98 -0
  69. data/test/fixtures/offer_find.yml +683 -0
  70. data/test/fixtures/offer_search.yml +329 -0
  71. data/test/fixtures/offer_search_fail_member_key.yml +102 -0
  72. data/test/fixtures/redeem_offer_no_redeem_type.yml +423 -0
  73. data/test/fixtures/store_find.yml +333 -0
  74. data/test/fixtures/store_search.yml +227 -0
  75. data/test/fixtures/store_search_fail_member_key.yml +102 -0
  76. data/test/fixtures/subcategory_find.yml +283 -0
  77. data/test/fixtures/token_find.yml +245 -0
  78. data/test/fixtures/token_search.yml +301 -0
  79. data/test/fixtures/verify_filter.yml +290 -0
  80. data/test/fixtures/verify_token.yml +78 -0
  81. data/test/test_helper.rb +15 -0
  82. metadata +183 -11
  83. data/test/offers/offer_test.rb +0 -5
@@ -0,0 +1,163 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://token-demo.adcrws.com/v1/oauth_applications/22?member_key=guest
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Access-Token:
11
+ - token_without_limit
12
+ Content-Type:
13
+ - application/json
14
+ Accept:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Access-Control-Allow-Headers:
22
+ - Origin, X-Requested-With, Content-Type, Accept, Authorization, Access-Token
23
+ Access-Control-Allow-Methods:
24
+ - POST, GET, PUT, DELETE, OPTIONS
25
+ Access-Control-Max-Age:
26
+ - '1728000'
27
+ Access-Control-Request-Method:
28
+ - GET
29
+ Cache-Control:
30
+ - max-age=0, private, must-revalidate
31
+ Content-Type:
32
+ - application/json
33
+ Date:
34
+ - Tue, 04 Aug 2015 21:47:34 GMT
35
+ Etag:
36
+ - '"a6b45fc13ff04948fb90164dd38b7ee4"'
37
+ Server:
38
+ - nginx/1.6.2
39
+ Strict-Transport-Security:
40
+ - max-age=31536000
41
+ X-Content-Type-Options:
42
+ - nosniff
43
+ X-Frame-Options:
44
+ - SAMEORIGIN
45
+ X-Request-Id:
46
+ - 36271a38-0fb3-489e-8dda-a6e837eb4701
47
+ X-Runtime:
48
+ - '0.044363'
49
+ X-Xss-Protection:
50
+ - 1; mode=block
51
+ Content-Length:
52
+ - '475'
53
+ Connection:
54
+ - keep-alive
55
+ body:
56
+ encoding: UTF-8
57
+ string: |-
58
+ {
59
+ "oauth_applications": [
60
+ {
61
+ "id": 22,
62
+ "name": "American Grandparents Association",
63
+ "owner_id": 235308134,
64
+ "owner_type": "Program",
65
+ "domain_urls": null,
66
+ "scopes": [
67
+ "api",
68
+ "docs"
69
+ ],
70
+ "active_tokens": [
71
+ "e4db3fb9a054e78807c431e837c49a59553c73204de91d404fe43d12c247f805"
72
+ ],
73
+ "filter": {
74
+ "filter_id": 18,
75
+ "filter_name": "Grandparents"
76
+ },
77
+ "links": null
78
+ }
79
+ ]
80
+ }
81
+ http_version:
82
+ recorded_at: Tue, 04 Aug 2015 21:47:34 GMT
83
+ - request:
84
+ method: get
85
+ uri: https://token-demo.adcrws.com/v1/oauth_applications/22
86
+ body:
87
+ encoding: US-ASCII
88
+ string: ''
89
+ headers:
90
+ Access-Token:
91
+ - token_without_limit
92
+ Content-Type:
93
+ - application/json
94
+ Accept:
95
+ - application/json
96
+ response:
97
+ status:
98
+ code: 200
99
+ message: OK
100
+ headers:
101
+ Access-Control-Allow-Headers:
102
+ - Origin, X-Requested-With, Content-Type, Accept, Authorization, Access-Token
103
+ Access-Control-Allow-Methods:
104
+ - POST, GET, PUT, DELETE, OPTIONS
105
+ Access-Control-Max-Age:
106
+ - '1728000'
107
+ Access-Control-Request-Method:
108
+ - GET
109
+ Cache-Control:
110
+ - max-age=0, private, must-revalidate
111
+ Content-Type:
112
+ - application/json
113
+ Date:
114
+ - Wed, 12 Aug 2015 17:46:38 GMT
115
+ Etag:
116
+ - '"a6b45fc13ff04948fb90164dd38b7ee4"'
117
+ Server:
118
+ - nginx/1.6.2
119
+ Strict-Transport-Security:
120
+ - max-age=31536000
121
+ X-Content-Type-Options:
122
+ - nosniff
123
+ X-Frame-Options:
124
+ - SAMEORIGIN
125
+ X-Request-Id:
126
+ - 51c4fc5b-e297-43fe-acc5-1eb93a0ca758
127
+ X-Runtime:
128
+ - '0.046357'
129
+ X-Xss-Protection:
130
+ - 1; mode=block
131
+ Content-Length:
132
+ - '475'
133
+ Connection:
134
+ - keep-alive
135
+ body:
136
+ encoding: UTF-8
137
+ string: |-
138
+ {
139
+ "oauth_applications": [
140
+ {
141
+ "id": 22,
142
+ "name": "American Grandparents Association",
143
+ "owner_id": 235308134,
144
+ "owner_type": "Program",
145
+ "domain_urls": null,
146
+ "scopes": [
147
+ "api",
148
+ "docs"
149
+ ],
150
+ "active_tokens": [
151
+ "e4db3fb9a054e78807c431e837c49a59553c73204de91d404fe43d12c247f805"
152
+ ],
153
+ "filter": {
154
+ "filter_id": 18,
155
+ "filter_name": "Grandparents"
156
+ },
157
+ "links": null
158
+ }
159
+ ]
160
+ }
161
+ http_version:
162
+ recorded_at: Wed, 12 Aug 2015 17:46:38 GMT
163
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,134 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://token-demo.adcrws.com/v1/oauth_applications
6
+ body:
7
+ encoding: UTF-8
8
+ string: per_page=1
9
+ headers:
10
+ Access-Token:
11
+ - token_without_limit
12
+ Content-Type:
13
+ - application/json
14
+ Accept:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 400
19
+ message: Bad Request
20
+ headers:
21
+ Content-Type:
22
+ - application/json
23
+ Date:
24
+ - Thu, 06 Aug 2015 17:30:00 GMT
25
+ Server:
26
+ - nginx/1.6.2
27
+ Strict-Transport-Security:
28
+ - max-age=31536000
29
+ X-Request-Id:
30
+ - eae4639f-45a0-4fd4-9da6-414112ffd2d9
31
+ X-Runtime:
32
+ - '0.000797'
33
+ Content-Length:
34
+ - '111'
35
+ Connection:
36
+ - keep-alive
37
+ body:
38
+ encoding: UTF-8
39
+ string: '{"status":400,"message":"There was a problem in the JSON you submitted:
40
+ 795: unexpected token at ''per_page=1''"}'
41
+ http_version:
42
+ recorded_at: Thu, 06 Aug 2015 17:30:00 GMT
43
+ - request:
44
+ method: get
45
+ uri: https://token-demo.adcrws.com/v1/oauth_applications?per_page=1
46
+ body:
47
+ encoding: US-ASCII
48
+ string: ''
49
+ headers:
50
+ Access-Token:
51
+ - token_without_limit
52
+ Content-Type:
53
+ - application/json
54
+ Accept:
55
+ - application/json
56
+ response:
57
+ status:
58
+ code: 200
59
+ message: OK
60
+ headers:
61
+ Access-Control-Allow-Headers:
62
+ - Origin, X-Requested-With, Content-Type, Accept, Authorization, Access-Token
63
+ Access-Control-Allow-Methods:
64
+ - POST, GET, PUT, DELETE, OPTIONS
65
+ Access-Control-Max-Age:
66
+ - '1728000'
67
+ Access-Control-Request-Method:
68
+ - GET
69
+ Cache-Control:
70
+ - max-age=0, private, must-revalidate
71
+ Content-Type:
72
+ - application/json
73
+ Date:
74
+ - Wed, 12 Aug 2015 17:46:38 GMT
75
+ Etag:
76
+ - '"e6267736da78274dfb6ded3a6d977308"'
77
+ Server:
78
+ - nginx/1.6.2
79
+ Strict-Transport-Security:
80
+ - max-age=31536000
81
+ X-Content-Type-Options:
82
+ - nosniff
83
+ X-Frame-Options:
84
+ - SAMEORIGIN
85
+ X-Request-Id:
86
+ - c1c2df23-c20f-40d5-a338-1fd75945db12
87
+ X-Runtime:
88
+ - '0.045503'
89
+ X-Xss-Protection:
90
+ - 1; mode=block
91
+ Content-Length:
92
+ - '778'
93
+ Connection:
94
+ - keep-alive
95
+ body:
96
+ encoding: UTF-8
97
+ string: |-
98
+ {
99
+ "info": {
100
+ "total_results": 703,
101
+ "results_per_page": 1,
102
+ "current_page": 1,
103
+ "total_pages": 703
104
+ },
105
+ "oauth_applications": [
106
+ {
107
+ "id": 22,
108
+ "name": "American Grandparents Association",
109
+ "owner_id": 235308134,
110
+ "owner_type": "Program",
111
+ "domain_urls": null,
112
+ "scopes": [
113
+ "api",
114
+ "docs"
115
+ ],
116
+ "active_tokens": [
117
+ "e4db3fb9a054e78807c431e837c49a59553c73204de91d404fe43d12c247f805"
118
+ ],
119
+ "filter": {
120
+ "filter_id": 18,
121
+ "filter_name": "Grandparents"
122
+ },
123
+ "links": {
124
+ "show_application": "https://token-demo.adcrws.com/v1/oauth_applications/22"
125
+ }
126
+ }
127
+ ],
128
+ "links": {
129
+ "next_page": "https://report-demo.adcrws.com/v1/oauth_applications?page=2"
130
+ }
131
+ }
132
+ http_version:
133
+ recorded_at: Wed, 12 Aug 2015 17:46:38 GMT
134
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,268 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://token-demo.adcrws.com/v1/oauth_applications?query=pizza
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Access-Token:
11
+ - token_without_limit
12
+ Content-Type:
13
+ - application/json
14
+ Accept:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Access-Control-Allow-Headers:
22
+ - Origin, X-Requested-With, Content-Type, Accept, Authorization, Access-Token
23
+ Access-Control-Allow-Methods:
24
+ - POST, GET, PUT, DELETE, OPTIONS
25
+ Access-Control-Max-Age:
26
+ - '1728000'
27
+ Access-Control-Request-Method:
28
+ - GET
29
+ Cache-Control:
30
+ - max-age=0, private, must-revalidate
31
+ Content-Type:
32
+ - application/json
33
+ Date:
34
+ - Tue, 04 Aug 2015 21:29:35 GMT
35
+ Etag:
36
+ - '"1155942a67e5ead77b51209eff6ac9e9"'
37
+ Server:
38
+ - nginx/1.6.2
39
+ Strict-Transport-Security:
40
+ - max-age=31536000
41
+ X-Content-Type-Options:
42
+ - nosniff
43
+ X-Frame-Options:
44
+ - SAMEORIGIN
45
+ X-Request-Id:
46
+ - b9896696-7c23-4459-a515-af993bf3f130
47
+ X-Runtime:
48
+ - '0.063198'
49
+ X-Xss-Protection:
50
+ - 1; mode=block
51
+ Content-Length:
52
+ - '5397'
53
+ Connection:
54
+ - keep-alive
55
+ body:
56
+ encoding: UTF-8
57
+ string: |-
58
+ {
59
+ "info": {
60
+ "total_results": 702,
61
+ "results_per_page": 10,
62
+ "current_page": 1,
63
+ "total_pages": 71
64
+ },
65
+ "oauth_applications": [
66
+ {
67
+ "id": 22,
68
+ "name": "American Grandparents Association",
69
+ "owner_id": 235308134,
70
+ "owner_type": "Program",
71
+ "domain_urls": null,
72
+ "scopes": [
73
+ "api",
74
+ "docs"
75
+ ],
76
+ "active_tokens": [
77
+ "e4db3fb9a054e78807c431e837c49a59553c73204de91d404fe43d12c247f805"
78
+ ],
79
+ "filter": {
80
+ "filter_id": 18,
81
+ "filter_name": "Grandparents"
82
+ },
83
+ "links": {
84
+ "show_application": "https://token-demo.adcrws.com/v1/oauth_applications/22"
85
+ }
86
+ },
87
+ {
88
+ "id": 31,
89
+ "name": "IGIFT Back",
90
+ "owner_id": 234482199,
91
+ "owner_type": "Program",
92
+ "domain_urls": "localhost, plus.igiftback.org, plus.igiftback.net",
93
+ "scopes": [
94
+ "api"
95
+ ],
96
+ "active_tokens": [
97
+ "50e34a00a8a0a7468c2d408b3564c78416c7397fda95fcd391d2e0f139152f2c"
98
+ ],
99
+ "filter": {
100
+ "filter_id": 39,
101
+ "filter_name": "iGiftBack - Auto, Dining, Entertainment, Golf, Home/Garden, Movies, Services, Shopping, Instore Print ONLY"
102
+ },
103
+ "links": {
104
+ "show_application": "https://token-demo.adcrws.com/v1/oauth_applications/31"
105
+ }
106
+ },
107
+ {
108
+ "id": 649,
109
+ "name": "amt-test",
110
+ "owner_id": 230907234,
111
+ "owner_type": "Program",
112
+ "domain_urls": null,
113
+ "scopes": [
114
+ "amt"
115
+ ],
116
+ "active_tokens": [
117
+ "7a044e366ee35284cc57dd02f5468f2f96f411e0df09ea37dad36a3581e64510"
118
+ ],
119
+ "filter": {
120
+ "filter_id": 16,
121
+ "filter_name": "No Content Filter"
122
+ },
123
+ "links": {
124
+ "show_application": "https://token-demo.adcrws.com/v1/oauth_applications/649"
125
+ }
126
+ },
127
+ {
128
+ "id": 32,
129
+ "name": "Rewards for Recycling",
130
+ "owner_id": 1090,
131
+ "owner_type": "Program",
132
+ "domain_urls": "www.rizzorewards.com,www.emterrarewards.com,r4rnet.com",
133
+ "scopes": [
134
+
135
+ ],
136
+ "active_tokens": [
137
+ "fab2e7ffa62f0059929fa8296ae0f82d96f33ec0aa51905d31fcb805e5d6fc5c",
138
+ "b33f6659908758aee9132f7fac7f39ec93a4b6ee92f8201e06d5e39691ae20e2"
139
+ ],
140
+ "filter": {
141
+ "filter_id": 33,
142
+ "filter_name": "Auto, Car Rental, Cruise, Dining, Entertainment, Golf, Health/Beauty, Home/Garden, Hotel, Movies, Services, Shopping, Travel"
143
+ },
144
+ "links": {
145
+ "show_application": "https://token-demo.adcrws.com/v1/oauth_applications/32"
146
+ }
147
+ },
148
+ {
149
+ "id": 653,
150
+ "name": "DreamWorld",
151
+ "owner_id": 339,
152
+ "owner_type": "Program",
153
+ "domain_urls": null,
154
+ "scopes": [
155
+
156
+ ],
157
+ "active_tokens": [
158
+ "2c863bc19218e8ad834b53b2c322c861ba0923173c082f8a83143a1cb33cc71c"
159
+ ],
160
+ "filter": {
161
+ "filter_id": 38,
162
+ "filter_name": "All Categories except EDUCATION ONLY"
163
+ },
164
+ "links": {
165
+ "show_application": "https://token-demo.adcrws.com/v1/oauth_applications/653"
166
+ }
167
+ },
168
+ {
169
+ "id": 15,
170
+ "name": "RetailMeNot",
171
+ "owner_id": 191718123,
172
+ "owner_type": "Program",
173
+ "domain_urls": null,
174
+ "scopes": [
175
+
176
+ ],
177
+ "active_tokens": [
178
+ "d9bf1c1741f07b96389fae9377f54de3b237e0b64a1e3dc07f2615bd7fa5874d"
179
+ ],
180
+ "filter": {
181
+ "filter_id": 14,
182
+ "filter_name": "Retail Me Not"
183
+ },
184
+ "links": {
185
+ "show_application": "https://token-demo.adcrws.com/v1/oauth_applications/15"
186
+ }
187
+ },
188
+ {
189
+ "id": 14,
190
+ "name": "Viggle",
191
+ "owner_id": 2192,
192
+ "owner_type": "Program",
193
+ "domain_urls": null,
194
+ "scopes": [
195
+ "api"
196
+ ],
197
+ "active_tokens": [
198
+ "3ad8453fbb347995e648d8925c6582073d043b2dff2332082be90e5b9c23b440"
199
+ ],
200
+ "filter": {
201
+ "filter_id": 13,
202
+ "filter_name": "VIGGLE"
203
+ },
204
+ "links": {
205
+ "show_application": "https://token-demo.adcrws.com/v1/oauth_applications/14"
206
+ }
207
+ },
208
+ {
209
+ "id": 18,
210
+ "name": "SaveOn Resorts",
211
+ "owner_id": 215,
212
+ "owner_type": "Program",
213
+ "domain_urls": null,
214
+ "scopes": [
215
+
216
+ ],
217
+ "active_tokens": [
218
+ "cec4ead0e094d3b27e2d82e8684503a6c2ccb2a01e27c3e8df107fc76cc4c372"
219
+ ],
220
+ "filter": null,
221
+ "links": {
222
+ "show_application": "https://token-demo.adcrws.com/v1/oauth_applications/18"
223
+ }
224
+ },
225
+ {
226
+ "id": 654,
227
+ "name": "API CREATE TEST",
228
+ "owner_id": 161,
229
+ "owner_type": "Program",
230
+ "domain_urls": null,
231
+ "scopes": [
232
+ "admin",
233
+ "api",
234
+ "public"
235
+ ],
236
+ "active_tokens": [
237
+ "42502aed0cb85ed4df362ccb60ec431c70201bd51aa68afaf5570b5fcff3cc42"
238
+ ],
239
+ "filter": null,
240
+ "links": {
241
+ "show_application": "https://token-demo.adcrws.com/v1/oauth_applications/654"
242
+ }
243
+ },
244
+ {
245
+ "id": 655,
246
+ "name": "TEST TEST",
247
+ "owner_id": 1234,
248
+ "owner_type": "Program",
249
+ "domain_urls": null,
250
+ "scopes": [
251
+ "api"
252
+ ],
253
+ "active_tokens": [
254
+ "7d584cd25a6ff1477d135d61e8132ef576b4da90cabed63b8bf1e3e98078db49"
255
+ ],
256
+ "filter": null,
257
+ "links": {
258
+ "show_application": "https://token-demo.adcrws.com/v1/oauth_applications/655"
259
+ }
260
+ }
261
+ ],
262
+ "links": {
263
+ "next_page": "https://report-demo.adcrws.com/v1/oauth_applications?page=2"
264
+ }
265
+ }
266
+ http_version:
267
+ recorded_at: Tue, 04 Aug 2015 21:29:35 GMT
268
+ recorded_with: VCR 2.9.3