infobip-twofactor 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 +4 -4
- data/lib/infobip/twofactor/api.rb +3 -4
- data/lib/infobip/twofactor/version.rb +1 -1
- data/spec/twofactor_api_spec.rb +1 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5e31fd0716a9b302a593c60f0eadbdb5dcd04a7
|
4
|
+
data.tar.gz: 2ab4169ba41545cc68366f3f5f9e5801b3873676
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a60e6bfbf5a5ee6051b196daf0b3e9b3c92c576bcea52cdc851a2c03de90f51396a7982bc80f6eccbfb9424a0ba092bcc6fe5f75ba0db9de56b8f1e5d737d24a
|
7
|
+
data.tar.gz: bb8d091f16eea12c75b945aebd83c0c2633c044cadefe8eb37bac8a10eafc937900eb9d48fef1951905969dc97f0f79c4f8a35b38e268af5bd84336363cbbab0
|
@@ -6,7 +6,6 @@ module Infobip
|
|
6
6
|
class API
|
7
7
|
|
8
8
|
attr_reader :api_key
|
9
|
-
attr_reader :pin_id
|
10
9
|
attr_reader :application_id
|
11
10
|
attr_reader :message_id
|
12
11
|
|
@@ -44,9 +43,9 @@ module Infobip
|
|
44
43
|
response
|
45
44
|
end
|
46
45
|
|
47
|
-
def verify_pin(pin)
|
48
|
-
raise "Missing pin id" unless
|
49
|
-
response = @api.pin(
|
46
|
+
def verify_pin(pin_id, pin)
|
47
|
+
raise "Missing pin id" unless pin_id
|
48
|
+
response = @api.pin(pin_id).verify._post(pin: pin)
|
50
49
|
raise "Malformed two factor API response - no verified field" unless (response.respond_to?(:verified))
|
51
50
|
response
|
52
51
|
end
|
data/spec/twofactor_api_spec.rb
CHANGED
@@ -28,14 +28,9 @@ describe Infobip::Twofactor::API do
|
|
28
28
|
expect(response[:smsStatus]).to eq "MESSAGE_SENT"
|
29
29
|
end
|
30
30
|
|
31
|
-
it "should store pin_id value" do
|
32
|
-
response = subject.send_pin("48790809242")
|
33
|
-
expect(subject.pin_id).to eq "2B29B71922B37D3C93F8CEBB85B9E3CF"
|
34
|
-
end
|
35
|
-
|
36
31
|
it "should create a valid Verify PIN request, given valid params" do
|
37
32
|
response = subject.send_pin("48790809242")
|
38
|
-
response = subject.verify_pin("1234")
|
33
|
+
response = subject.verify_pin("2B29B71922B37D3C93F8CEBB85B9E3CF", "1234")
|
39
34
|
expect(response[:verified]).to eq true
|
40
35
|
end
|
41
36
|
|