instant2fa 1.0.0 → 1.0.1

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: 92f22c0eba52c601775190b06df52a01a542dd6d
4
- data.tar.gz: ceb93913fe81a5c234da5f4ad39149e1f5fa0646
3
+ metadata.gz: dab4c1136bfefcb63c4667db976421bbfdc247d2
4
+ data.tar.gz: cc2f314c49b09a44a50041484baa807cff121b46
5
5
  SHA512:
6
- metadata.gz: 1602461a5c198fc6e2bb655c31fdfe1ed04f72f195afac3122e95a95f3d6c5ec6cee82338d1694fbb80a10e4dd6770aba85c679adbf343e6214a32e9332f6dff
7
- data.tar.gz: a6bcaaa6a8aa48060e452cb870970fc483887c611dbc3bc9297508b9a5c2cc819cbd3dc19c533be1f252be988ab366c98b10cdd5a6b635d480ace7f4745592c9
6
+ metadata.gz: 0e513eed40d53e7fe8ab649a08ccbfa49627059de13d37a5373295b4d54986f5ac35507bfaf5c0931766ccb088f012c82d1ba9e72309224ff034d5dad257aa5b
7
+ data.tar.gz: b38743cda9142de5cf94f5dcf8c114a57576beec384a14ecb33f429cc9671fc58e561e5ce64311eb71b7079f5ce87ef1fafb4bb5a66ab74e0ccfe3f6f93d218c
@@ -23,14 +23,18 @@ module Instant2fa
23
23
  end
24
24
 
25
25
  def create_settings(distinct_id, options = {})
26
- user_access_token = Resources::UserAccessToken.create(distinct_id: distinct_id)
26
+ raise Errors::BadDistinctID, "distinct_id cannot be nil" unless distinct_id
27
+
28
+ user_access_token = Resources::UserAccessToken.create(distinct_id: distinct_id.to_s)
27
29
  raise_if_errors(user_access_token)
28
30
  return user_access_token.hosted_page_url
29
31
  end
30
32
 
31
33
  def create_verification(distinct_id, options = {})
34
+ raise Errors::BadDistinctID, "distinct_id cannot be nil" unless distinct_id
35
+
32
36
  begin
33
- verification_request = Resources::VerificationRequest.create(distinct_id: distinct_id)
37
+ verification_request = Resources::VerificationRequest.create(distinct_id: distinct_id.to_s)
34
38
  raise_if_errors(verification_request)
35
39
  rescue JsonApiClient::Errors::UnprocessableEntity
36
40
  raise Errors::MFANotEnabled.new, "User has not enabled an MFA device on their account."
@@ -40,10 +44,12 @@ module Instant2fa
40
44
  end
41
45
 
42
46
  def confirm_verification(distinct_id, token, options = {})
47
+ raise Errors::BadDistinctID, "distinct_id cannot be nil" unless distinct_id
48
+
43
49
  verification_response_result_set = Resources::VerificationResponseToken.find(token)
44
50
  verification_response = verification_response_result_set[0]
45
51
 
46
- if verification_response.distinct_id != distinct_id
52
+ if verification_response.distinct_id != distinct_id.to_s
47
53
  raise Errors::VerificationMismatch, "The distinctID passed back from the request didn't match the one passed into this function. Are you passing in the right value for distinctID?"
48
54
  end
49
55
 
@@ -14,5 +14,8 @@ module Instant2fa
14
14
 
15
15
  class VerificationFailed < Instant2faError
16
16
  end
17
+
18
+ class BadDistinctID < Instant2faError
19
+ end
17
20
  end
18
21
  end
@@ -1,3 +1,3 @@
1
1
  module Instant2fa
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instant2fa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Pollak
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-09 00:00:00.000000000 Z
11
+ date: 2016-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler