instant2fa 1.0.0 → 1.0.1
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/lib/instant2fa/client.rb +9 -3
- data/lib/instant2fa/errors.rb +3 -0
- data/lib/instant2fa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dab4c1136bfefcb63c4667db976421bbfdc247d2
|
4
|
+
data.tar.gz: cc2f314c49b09a44a50041484baa807cff121b46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e513eed40d53e7fe8ab649a08ccbfa49627059de13d37a5373295b4d54986f5ac35507bfaf5c0931766ccb088f012c82d1ba9e72309224ff034d5dad257aa5b
|
7
|
+
data.tar.gz: b38743cda9142de5cf94f5dcf8c114a57576beec384a14ecb33f429cc9671fc58e561e5ce64311eb71b7079f5ce87ef1fafb4bb5a66ab74e0ccfe3f6f93d218c
|
data/lib/instant2fa/client.rb
CHANGED
@@ -23,14 +23,18 @@ module Instant2fa
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def create_settings(distinct_id, options = {})
|
26
|
-
|
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
|
|
data/lib/instant2fa/errors.rb
CHANGED
data/lib/instant2fa/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|