access 2.0.31 → 2.0.32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1c5f52b28a9127e3d51ad4f176c2fe0435afdb1
4
- data.tar.gz: e69e50198a6f0811ec88dead85a70d9d339240cc
3
+ metadata.gz: 0370e9f25d3cb1edb3c7dcf0403d27756d255180
4
+ data.tar.gz: 92585f2dbcdac30fb518db6a59c988d68be02e31
5
5
  SHA512:
6
- metadata.gz: ebe0faed4f4cd37100e0ead4bfd94159196d7f7eabcbafcb9e684a1f0d436de493871bff7b75cc132f53ffe33d0bb1188c24410185ae63e86f59c1ef94c01e34
7
- data.tar.gz: 71c6a06f4ad1024c2b127843f619054bdffef1858dde0fa3aa0a14d8fe96fc3ab7d5e6499afa7529dd3b7a8a1581539b42584898218c71acf9040dd24961b1fb
6
+ metadata.gz: 8536d4b49483ac37009572a689be6d334e89cdc6efd7804e560403a89c9ef842512cbbe3a2f5581acbff6b3b747e6c0b99e6acbe0233c65eaf6af8e195c8e2a6
7
+ data.tar.gz: e2a43b859e9c6c9526841119804a313e3e7d64cb26de608b9c89e51df3187d4b0342d11f909ea086d1996d9804b2ad07058417afc1de7f570d6b331c2b7c9773
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- access (2.0.31)
4
+ access (2.0.32)
5
5
  hashie (~> 3.3.1)
6
6
  httparty (~> 0.13.3)
7
7
 
data/lib/access/api.rb CHANGED
@@ -140,8 +140,14 @@ module Access
140
140
  end
141
141
 
142
142
  def member_authentication(options = {})
143
- request.post("/auth", "mms", options) do |response|
144
- MemberResponse.new(response)
143
+ if options[:email] && options[:password] # email/pass does not respond to get
144
+ request.post("/auth", "mms", options) do |response|
145
+ MemberResponse.new(response)
146
+ end
147
+ else # cvt does not respond to post
148
+ request.get("/auth", "mms", options) do |response|
149
+ MemberResponse.new(response)
150
+ end
145
151
  end
146
152
  end
147
153
 
@@ -1,4 +1,4 @@
1
1
  module Access
2
- VERSION = "2.0.31"
2
+ VERSION = "2.0.32"
3
3
  end
4
4
 
@@ -46,6 +46,28 @@ class MemberTest < Minitest::Test
46
46
  end
47
47
  end
48
48
 
49
+ def test_authenticate_cvt_success
50
+ VCR.use_cassette('member authenticate cvt success') do
51
+ request = Access::Member.authenticate cvt: '6fa6c66c4edc07b767f147a6e5fc614c20797ef0', api_environment: 'stage'
52
+ assert request.success
53
+ assert_kind_of Access::MemberResponse, request
54
+ assert_kind_of Array, request.users
55
+ assert_equal 1, request.users.count
56
+ assert_kind_of Access::Member, request.users.first
57
+ end
58
+ end
59
+
60
+ def test_authenticate_cvt_failure
61
+ VCR.use_cassette('member authenticate cvt failure') do
62
+ request = Access::Member.authenticate cvt: 'thisisaverybadcvtman1234556badbadbad', api_environment: 'stage'
63
+ refute request.success
64
+ assert_equal 401, request.status
65
+ assert_kind_of Access::MemberResponse, request
66
+ refute_nil request.error
67
+ assert_kind_of Access::Error, request.error
68
+ end
69
+ end
70
+
49
71
  def registration_params
50
72
  {
51
73
  program_id: 2412,
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://mms-stage.adcrws.com/v1/auth?cvt=thisisaverybadcvtman1234556badbadbad
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Access-Token:
11
+ - ACCESS_TOKEN
12
+ Content-Type:
13
+ - application/json
14
+ Accept:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 401
19
+ message: Unauthorized
20
+ headers:
21
+ Server:
22
+ - Apache-Coyote/1.1
23
+ X-Content-Type-Options:
24
+ - nosniff
25
+ X-Xss-Protection:
26
+ - 1; mode=block
27
+ Cache-Control:
28
+ - no-cache, no-store, max-age=0, must-revalidate
29
+ Pragma:
30
+ - no-cache
31
+ Expires:
32
+ - '0'
33
+ X-Frame-Options:
34
+ - DENY
35
+ X-Application-Context:
36
+ - application:main,stage:10110
37
+ Content-Type:
38
+ - application/json;charset=UTF-8
39
+ Transfer-Encoding:
40
+ - chunked
41
+ Date:
42
+ - Tue, 01 Dec 2015 19:44:17 GMT
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"message":"No active user with specified CVT found.","status":401}'
46
+ http_version:
47
+ recorded_at: Tue, 01 Dec 2015 19:43:15 GMT
48
+ recorded_with: VCR 3.0.0
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://mms-stage.adcrws.com/v1/auth?cvt=6fa6c66c4edc07b767f147a6e5fc614c20797ef0
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Access-Token:
11
+ - ACCESS_TOKEN
12
+ Content-Type:
13
+ - application/json
14
+ Accept:
15
+ - application/json
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Server:
22
+ - Apache-Coyote/1.1
23
+ X-Content-Type-Options:
24
+ - nosniff
25
+ X-Xss-Protection:
26
+ - 1; mode=block
27
+ Cache-Control:
28
+ - no-cache, no-store, max-age=0, must-revalidate
29
+ Pragma:
30
+ - no-cache
31
+ Expires:
32
+ - '0'
33
+ X-Frame-Options:
34
+ - DENY
35
+ X-Application-Context:
36
+ - application:main,stage:10120
37
+ Content-Type:
38
+ - application/json;charset=UTF-8
39
+ Transfer-Encoding:
40
+ - chunked
41
+ Date:
42
+ - Tue, 01 Dec 2015 19:41:59 GMT
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"users":[{"program_id":2412,"program_key":"TYP123","program_name":"Thank
46
+ You Perks","organization_id":2000896,"organization_key":"TYPDEMO","organization_name":"Thank
47
+ You Perks Demo","member_id":89738626,"member_key":"226872","email":"cs@test.com","first_name":"Cody","last_name":"Stringham","reg_id":1084059,"cvt":"6fa6c66c4edc07b767f147a6e5fc614c20797ef0","postal_code":"84047","roles":[]}]}'
48
+ http_version:
49
+ recorded_at: Tue, 01 Dec 2015 19:40:57 GMT
50
+ recorded_with: VCR 3.0.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: access
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.31
4
+ version: 2.0.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett
@@ -305,6 +305,8 @@ files:
305
305
  - test/vcr/cassettes/location_find.yml
306
306
  - test/vcr/cassettes/location_search.yml
307
307
  - test/vcr/cassettes/location_search_fail_member_key.yml
308
+ - test/vcr/cassettes/member_authenticate_cvt_failure.yml
309
+ - test/vcr/cassettes/member_authenticate_cvt_success.yml
308
310
  - test/vcr/cassettes/member_authenticate_failure.yml
309
311
  - test/vcr/cassettes/member_authenticate_success.yml
310
312
  - test/vcr/cassettes/member_location_frequent.yml
@@ -427,6 +429,8 @@ test_files:
427
429
  - test/vcr/cassettes/location_find.yml
428
430
  - test/vcr/cassettes/location_search.yml
429
431
  - test/vcr/cassettes/location_search_fail_member_key.yml
432
+ - test/vcr/cassettes/member_authenticate_cvt_failure.yml
433
+ - test/vcr/cassettes/member_authenticate_cvt_success.yml
430
434
  - test/vcr/cassettes/member_authenticate_failure.yml
431
435
  - test/vcr/cassettes/member_authenticate_success.yml
432
436
  - test/vcr/cassettes/member_location_frequent.yml