access 2.0.11 → 2.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/lib/access.rb +1 -0
  4. data/lib/access/api.rb +15 -1
  5. data/lib/access/redemption.rb +26 -0
  6. data/lib/access/response.rb +8 -9
  7. data/lib/access/version.rb +1 -1
  8. data/test/access/filter_test.rb +2 -0
  9. data/test/access/offer_test.rb +20 -2
  10. data/test/access/redeem_test.rb +1 -1
  11. data/test/access/redemption_test.rb +43 -0
  12. data/test/access/report_test.rb +77 -30
  13. data/test/test_helper.rb +5 -3
  14. data/test/vcr/cassettes/all_usage.yml +92 -0
  15. data/test/vcr/cassettes/autocomplete_search.yml +83 -0
  16. data/test/{fixtures → vcr/cassettes}/autocomplete_search_categories.yml +10 -10
  17. data/test/{fixtures → vcr/cassettes}/autocomplete_search_locations.yml +5 -5
  18. data/test/{fixtures → vcr/cassettes}/autocomplete_search_offers.yml +10 -10
  19. data/test/{fixtures → vcr/cassettes}/autocomplete_search_stores.yml +12 -12
  20. data/test/{fixtures → vcr/cassettes}/category_find.yml +7 -7
  21. data/test/{fixtures → vcr/cassettes}/category_search.yml +12 -12
  22. data/test/{fixtures → vcr/cassettes}/category_search_fail_member_key.yml +5 -5
  23. data/test/{fixtures → vcr/cassettes}/filter_find.yml +5 -5
  24. data/test/{fixtures → vcr/cassettes}/filter_search.yml +8 -8
  25. data/test/vcr/cassettes/find_redemption_by_member_key.yml +131 -0
  26. data/test/{fixtures → vcr/cassettes}/location_find.yml +8 -8
  27. data/test/{fixtures → vcr/cassettes}/location_search.yml +9 -9
  28. data/test/{fixtures → vcr/cassettes}/location_search_fail_member_key.yml +5 -5
  29. data/test/vcr/cassettes/member_location_frequent.yml +70 -0
  30. data/test/vcr/cassettes/member_location_recent.yml +70 -0
  31. data/test/vcr/cassettes/member_query_frequent.yml +73 -0
  32. data/test/vcr/cassettes/member_query_recent.yml +73 -0
  33. data/test/vcr/cassettes/national_stores.yml +1966 -0
  34. data/test/{fixtures → vcr/cassettes}/oauth_application_find.yml +5 -5
  35. data/test/{fixtures → vcr/cassettes}/oauth_application_search.yml +8 -8
  36. data/test/{fixtures → vcr/cassettes}/oauth_application_token_find.yml +5 -5
  37. data/test/{fixtures → vcr/cassettes}/oauth_application_token_search.yml +5 -5
  38. data/test/{fixtures → vcr/cassettes}/offer_find.yml +8 -8
  39. data/test/{fixtures → vcr/cassettes}/offer_search.yml +9 -9
  40. data/test/{fixtures → vcr/cassettes}/offer_search_fail_member_key.yml +5 -5
  41. data/test/vcr/cassettes/offer_with_aggregations.yml +935 -0
  42. data/test/vcr/cassettes/redeem_offer_no_redeem_type.yml +38 -0
  43. data/test/vcr/cassettes/redeem_offer_with_redeem_type.yml +38 -0
  44. data/test/vcr/cassettes/search_redemption_by_member_key.yml +762 -0
  45. data/test/vcr/cassettes/search_redemption_by_member_key_without_redemptions.yml +62 -0
  46. data/test/{fixtures → vcr/cassettes}/store_find.yml +5 -5
  47. data/test/{fixtures → vcr/cassettes}/store_search.yml +8 -8
  48. data/test/{fixtures → vcr/cassettes}/store_search_fail_member_key.yml +7 -7
  49. data/test/{fixtures → vcr/cassettes}/subcategory_find.yml +7 -7
  50. data/test/vcr/cassettes/token_find.yml +93 -0
  51. data/test/vcr/cassettes/token_get_first_token.yml +107 -0
  52. data/test/vcr/cassettes/token_search.yml +107 -0
  53. data/test/vcr/cassettes/usage.yml +92 -0
  54. data/test/vcr/cassettes/usage_other.yml +92 -0
  55. data/test/{fixtures → vcr/cassettes}/verify_filter.yml +17 -24
  56. data/test/{fixtures → vcr/cassettes}/verify_token.yml +6 -6
  57. metadata +91 -64
  58. data/test/fixtures/autocomplete_search.yml +0 -82
  59. data/test/fixtures/national_stores.yml +0 -1992
  60. data/test/fixtures/redeem_offer_no_redeem_type.yml +0 -73
  61. data/test/fixtures/token_find.yml +0 -92
  62. data/test/fixtures/token_get_first_token.yml +0 -106
  63. data/test/fixtures/token_search.yml +0 -106
@@ -1,73 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://redeem-demo.adcrws.com/v1/redeem/7365285/instore_print?member_key=API_RUBY_GEM_TEST
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
- Content-Type:
22
- - application/json;charset=UTF-8
23
- Date:
24
- - Wed, 16 Sep 2015 20:14:00 GMT
25
- Etag:
26
- - '"077b1d5df0e5215bf378d3b4fb4fc7027"'
27
- Server:
28
- - nginx/1.6.2
29
- Content-Length:
30
- - '204'
31
- Connection:
32
- - keep-alive
33
- body:
34
- encoding: UTF-8
35
- string: '{"redemption_method":"instore_print","content_type":"text/html","details":{"link":"http://static-demo.accessdevelopment.com/temp/coupon/34983fb3921fc7561b310804c87677f7c7dcb569/original.html"},"links":[]}'
36
- http_version:
37
- recorded_at: Wed, 16 Sep 2015 20:14:00 GMT
38
- - request:
39
- method: get
40
- uri: https://redeem-demo.adcrws.com/v1/redeem/7365285/?member_key=API_RUBY_GEM_TEST
41
- body:
42
- encoding: US-ASCII
43
- string: ''
44
- headers:
45
- Access-Token:
46
- - token_without_limit
47
- Content-Type:
48
- - application/json
49
- Accept:
50
- - application/json
51
- response:
52
- status:
53
- code: 200
54
- message: OK
55
- headers:
56
- Content-Type:
57
- - application/json;charset=UTF-8
58
- Date:
59
- - Wed, 16 Sep 2015 20:14:01 GMT
60
- Etag:
61
- - '"0ff5ab06abc27ae6bc33adccffb86e1ff"'
62
- Server:
63
- - nginx/1.6.2
64
- Content-Length:
65
- - '136'
66
- Connection:
67
- - keep-alive
68
- body:
69
- encoding: UTF-8
70
- string: '{"links":[{"rel":"instore_print","href":"https://redeem-demo.adcrws.com/v1/redeem/7365285/instore_print?member_key=API_RUBY_GEM_TEST"}]}'
71
- http_version:
72
- recorded_at: Wed, 16 Sep 2015 20:14:01 GMT
73
- recorded_with: VCR 2.9.3
@@ -1,92 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://token-demo.adcrws.com/v1/tokens/6a83e8e361cdd3eba145ccbabf05e65e8f3fa15544f808caa44aaf7f43e13e1f
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
- - Wed, 16 Sep 2015 20:13:59 GMT
35
- Etag:
36
- - '"e3836bc59d9265551e703f4ddb9e396d"'
37
- Server:
38
- - nginx/1.6.2
39
- X-Content-Type-Options:
40
- - nosniff
41
- X-Frame-Options:
42
- - SAMEORIGIN
43
- X-Request-Id:
44
- - 185f4df1-c9d4-4272-abdc-9436e51931e3
45
- X-Runtime:
46
- - '0.015631'
47
- X-Xss-Protection:
48
- - 1; mode=block
49
- Content-Length:
50
- - '1739'
51
- Connection:
52
- - keep-alive
53
- body:
54
- encoding: UTF-8
55
- string: |-
56
- {
57
- "oauth_token": {
58
- "application_id": 837,
59
- "token": "6a83e8e361cdd3eba145ccbabf05e65e8f3fa15544f808caa44aaf7f43e13e1f",
60
- "expires_in": null,
61
- "revoked_at": null,
62
- "created_at": "2015-09-16T11:50:27.755-06:00",
63
- "oauth_access_token_id": 959,
64
- "application_name": "Breakaway Loyalty (pcid: 8983)",
65
- "application_owner_id": 487,
66
- "application_owner_type": "Program",
67
- "program_id": 487,
68
- "program_name": "Breakaway Loyalty",
69
- "program_customer_identifier": "8983",
70
- "program_start_dts": "2012-04-12T15:10:31.634-06:00",
71
- "program_end_dts": "2018-12-30T17:00:00.000-07:00",
72
- "organization_id": 2000153,
73
- "organization_name": "BreakawaLoyalty",
74
- "organization_customer_identifier": "WEivv",
75
- "filter_id": 35,
76
- "filter_name": "Dining, Entertainment, Health/Beauty, Hotel, Services, Shopping",
77
- "filter": "{\"offers\":[{\"terms\":{\"offer_set\":[\"DISCOUNT\"]}},{\"or\":[{\"terms\":{\"categories.category_key\":[39,59,53,44,50,45]}},{\"terms\":{\"categories.category_parent_key\":[39,59,53,44,50,45]}}]}],\"categories\":[{\"or\":[{\"terms\":{\"category_key\":[39,59,53,44,50,45]}},{\"terms\":{\"category_parent_key\":[39,59,53,44,50,45]}}]}],\"stores\":[{\"or\":[{\"terms\":{\"store_categories.category_key\":[39,59,53,44,50,45]}},{\"terms\":{\"store_categories.category_parent_key\":[39,59,53,44,50,45]}}]}],\"locations\":[{\"or\":[{\"terms\":{\"location_categories.category_key\":[39,59,53,44,50,45]}},{\"terms\":{\"location_categories.category_parent_key\":[39,59,53,44,50,45]}}]}]}",
78
- "program_filter_id": 169,
79
- "domains": [
80
-
81
- ],
82
- "application_scopes": [
83
- "api",
84
- "docs"
85
- ],
86
- "indexed_at": "2015-09-16T20:12:03.020Z",
87
- "token_status": "valid"
88
- }
89
- }
90
- http_version:
91
- recorded_at: Wed, 16 Sep 2015 20:13:59 GMT
92
- recorded_with: VCR 2.9.3
@@ -1,106 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://token-demo.adcrws.com/v1/tokens?per_page=1
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
- - Wed, 16 Sep 2015 20:13:59 GMT
35
- Etag:
36
- - '"5992f26524404981212c22eaf981a568"'
37
- Server:
38
- - nginx/1.6.2
39
- X-Content-Type-Options:
40
- - nosniff
41
- X-Frame-Options:
42
- - SAMEORIGIN
43
- X-Request-Id:
44
- - f8457057-1ced-46d5-948c-d5e45fbf530c
45
- X-Runtime:
46
- - '0.018561'
47
- X-Xss-Protection:
48
- - 1; mode=block
49
- Content-Length:
50
- - '2181'
51
- Connection:
52
- - keep-alive
53
- body:
54
- encoding: UTF-8
55
- string: |-
56
- {
57
- "info": {
58
- "total_results": 546,
59
- "results_per_page": 1,
60
- "current_page": 1,
61
- "total_pages": 546
62
- },
63
- "oauth_tokens": [
64
- {
65
- "application_id": 837,
66
- "token": "6a83e8e361cdd3eba145ccbabf05e65e8f3fa15544f808caa44aaf7f43e13e1f",
67
- "expires_in": null,
68
- "revoked_at": null,
69
- "created_at": "2015-09-16T11:50:27.755-06:00",
70
- "oauth_access_token_id": 959,
71
- "application_name": "Breakaway Loyalty (pcid: 8983)",
72
- "application_owner_id": 487,
73
- "application_owner_type": "Program",
74
- "program_id": 487,
75
- "program_name": "Breakaway Loyalty",
76
- "program_customer_identifier": "8983",
77
- "program_start_dts": "2012-04-12T15:10:31.634-06:00",
78
- "program_end_dts": "2018-12-30T17:00:00.000-07:00",
79
- "organization_id": 2000153,
80
- "organization_name": "BreakawaLoyalty",
81
- "organization_customer_identifier": "WEivv",
82
- "filter_id": 35,
83
- "filter_name": "Dining, Entertainment, Health/Beauty, Hotel, Services, Shopping",
84
- "filter": "{\"offers\":[{\"terms\":{\"offer_set\":[\"DISCOUNT\"]}},{\"or\":[{\"terms\":{\"categories.category_key\":[39,59,53,44,50,45]}},{\"terms\":{\"categories.category_parent_key\":[39,59,53,44,50,45]}}]}],\"categories\":[{\"or\":[{\"terms\":{\"category_key\":[39,59,53,44,50,45]}},{\"terms\":{\"category_parent_key\":[39,59,53,44,50,45]}}]}],\"stores\":[{\"or\":[{\"terms\":{\"store_categories.category_key\":[39,59,53,44,50,45]}},{\"terms\":{\"store_categories.category_parent_key\":[39,59,53,44,50,45]}}]}],\"locations\":[{\"or\":[{\"terms\":{\"location_categories.category_key\":[39,59,53,44,50,45]}},{\"terms\":{\"location_categories.category_parent_key\":[39,59,53,44,50,45]}}]}]}",
85
- "program_filter_id": 169,
86
- "domains": [
87
-
88
- ],
89
- "application_scopes": [
90
- "api",
91
- "docs"
92
- ],
93
- "indexed_at": "2015-09-16T20:12:03.020Z",
94
- "token_status": "valid",
95
- "links": {
96
- "show_oauth_token": "http://token-demo.adcrws.com/v1/tokens/6a83e8e361cdd3eba145ccbabf05e65e8f3fa15544f808caa44aaf7f43e13e1f"
97
- }
98
- }
99
- ],
100
- "links": {
101
- "next_page": "https://token-demo.adcrws.com/v1/tokens?page=2&per_page=1"
102
- }
103
- }
104
- http_version:
105
- recorded_at: Wed, 16 Sep 2015 20:13:59 GMT
106
- recorded_with: VCR 2.9.3
@@ -1,106 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://token-demo.adcrws.com/v1/tokens?per_page=1
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
- - Wed, 16 Sep 2015 20:13:59 GMT
35
- Etag:
36
- - '"5992f26524404981212c22eaf981a568"'
37
- Server:
38
- - nginx/1.6.2
39
- X-Content-Type-Options:
40
- - nosniff
41
- X-Frame-Options:
42
- - SAMEORIGIN
43
- X-Request-Id:
44
- - 56ef32f3-5361-4814-818c-b1ef54dee1f2
45
- X-Runtime:
46
- - '0.018595'
47
- X-Xss-Protection:
48
- - 1; mode=block
49
- Content-Length:
50
- - '2181'
51
- Connection:
52
- - keep-alive
53
- body:
54
- encoding: UTF-8
55
- string: |-
56
- {
57
- "info": {
58
- "total_results": 546,
59
- "results_per_page": 1,
60
- "current_page": 1,
61
- "total_pages": 546
62
- },
63
- "oauth_tokens": [
64
- {
65
- "application_id": 837,
66
- "token": "6a83e8e361cdd3eba145ccbabf05e65e8f3fa15544f808caa44aaf7f43e13e1f",
67
- "expires_in": null,
68
- "revoked_at": null,
69
- "created_at": "2015-09-16T11:50:27.755-06:00",
70
- "oauth_access_token_id": 959,
71
- "application_name": "Breakaway Loyalty (pcid: 8983)",
72
- "application_owner_id": 487,
73
- "application_owner_type": "Program",
74
- "program_id": 487,
75
- "program_name": "Breakaway Loyalty",
76
- "program_customer_identifier": "8983",
77
- "program_start_dts": "2012-04-12T15:10:31.634-06:00",
78
- "program_end_dts": "2018-12-30T17:00:00.000-07:00",
79
- "organization_id": 2000153,
80
- "organization_name": "BreakawaLoyalty",
81
- "organization_customer_identifier": "WEivv",
82
- "filter_id": 35,
83
- "filter_name": "Dining, Entertainment, Health/Beauty, Hotel, Services, Shopping",
84
- "filter": "{\"offers\":[{\"terms\":{\"offer_set\":[\"DISCOUNT\"]}},{\"or\":[{\"terms\":{\"categories.category_key\":[39,59,53,44,50,45]}},{\"terms\":{\"categories.category_parent_key\":[39,59,53,44,50,45]}}]}],\"categories\":[{\"or\":[{\"terms\":{\"category_key\":[39,59,53,44,50,45]}},{\"terms\":{\"category_parent_key\":[39,59,53,44,50,45]}}]}],\"stores\":[{\"or\":[{\"terms\":{\"store_categories.category_key\":[39,59,53,44,50,45]}},{\"terms\":{\"store_categories.category_parent_key\":[39,59,53,44,50,45]}}]}],\"locations\":[{\"or\":[{\"terms\":{\"location_categories.category_key\":[39,59,53,44,50,45]}},{\"terms\":{\"location_categories.category_parent_key\":[39,59,53,44,50,45]}}]}]}",
85
- "program_filter_id": 169,
86
- "domains": [
87
-
88
- ],
89
- "application_scopes": [
90
- "api",
91
- "docs"
92
- ],
93
- "indexed_at": "2015-09-16T20:12:03.020Z",
94
- "token_status": "valid",
95
- "links": {
96
- "show_oauth_token": "http://token-demo.adcrws.com/v1/tokens/6a83e8e361cdd3eba145ccbabf05e65e8f3fa15544f808caa44aaf7f43e13e1f"
97
- }
98
- }
99
- ],
100
- "links": {
101
- "next_page": "https://token-demo.adcrws.com/v1/tokens?page=2&per_page=1"
102
- }
103
- }
104
- http_version:
105
- recorded_at: Wed, 16 Sep 2015 20:13:59 GMT
106
- recorded_with: VCR 2.9.3