authy 2.7.4 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock DELETED
@@ -1,118 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- addressable (2.4.0)
5
- ast (2.3.0)
6
- axiom-types (0.1.1)
7
- descendants_tracker (~> 0.0.4)
8
- ice_nine (~> 0.11.0)
9
- thread_safe (~> 0.3, >= 0.3.1)
10
- builder (3.2.3)
11
- codeclimate-engine-rb (0.4.1)
12
- virtus (~> 1.0)
13
- coderay (1.1.2)
14
- coercible (1.0.0)
15
- descendants_tracker (~> 0.0.1)
16
- descendants_tracker (0.0.4)
17
- thread_safe (~> 0.3, >= 0.3.1)
18
- diff-lcs (1.3)
19
- docile (1.1.5)
20
- equalizer (0.0.11)
21
- faraday (0.9.2)
22
- multipart-post (>= 1.2, < 3)
23
- git (1.3.0)
24
- github_api (0.16.0)
25
- addressable (~> 2.4.0)
26
- descendants_tracker (~> 0.0.4)
27
- faraday (~> 0.8, < 0.10)
28
- hashie (>= 3.4)
29
- mime-types (>= 1.16, < 3.0)
30
- oauth2 (~> 1.0)
31
- hashie (3.5.7)
32
- highline (1.7.10)
33
- httpclient (2.8.3)
34
- ice_nine (0.11.2)
35
- jeweler (2.3.7)
36
- builder
37
- bundler (>= 1)
38
- git (>= 1.2.5)
39
- github_api (~> 0.16.0)
40
- highline (>= 1.6.15)
41
- nokogiri (>= 1.5.10)
42
- psych (~> 2.2)
43
- rake
44
- rdoc
45
- semver2
46
- json (2.1.0)
47
- jwt (1.5.6)
48
- method_source (0.9.0)
49
- mime-types (2.99.3)
50
- mini_portile2 (2.3.0)
51
- multi_json (1.12.2)
52
- multi_xml (0.6.0)
53
- multipart-post (2.0.0)
54
- nokogiri (1.8.2)
55
- mini_portile2 (~> 2.3.0)
56
- oauth2 (1.4.0)
57
- faraday (>= 0.8, < 0.13)
58
- jwt (~> 1.0)
59
- multi_json (~> 1.3)
60
- multi_xml (~> 0.5)
61
- rack (>= 1.2, < 3)
62
- parser (2.4.0.2)
63
- ast (~> 2.3)
64
- pry (0.11.3)
65
- coderay (~> 1.1.0)
66
- method_source (~> 0.9.0)
67
- psych (2.2.4)
68
- rack (2.0.3)
69
- rainbow (2.2.2)
70
- rake
71
- rake (12.3.0)
72
- rdoc (6.0.0)
73
- reek (4.7.3)
74
- codeclimate-engine-rb (~> 0.4.0)
75
- parser (>= 2.4.0.0, < 2.5)
76
- rainbow (~> 2.0)
77
- rspec (3.7.0)
78
- rspec-core (~> 3.7.0)
79
- rspec-expectations (~> 3.7.0)
80
- rspec-mocks (~> 3.7.0)
81
- rspec-core (3.7.0)
82
- rspec-support (~> 3.7.0)
83
- rspec-expectations (3.7.0)
84
- diff-lcs (>= 1.2.0, < 2.0)
85
- rspec-support (~> 3.7.0)
86
- rspec-mocks (3.7.0)
87
- diff-lcs (>= 1.2.0, < 2.0)
88
- rspec-support (~> 3.7.0)
89
- rspec-support (3.7.0)
90
- semver2 (3.4.2)
91
- simplecov (0.15.1)
92
- docile (~> 1.1.0)
93
- json (>= 1.8, < 3)
94
- simplecov-html (~> 0.10.0)
95
- simplecov-html (0.10.2)
96
- thread_safe (0.3.6)
97
- virtus (1.0.5)
98
- axiom-types (~> 0.1)
99
- coercible (~> 1.0)
100
- descendants_tracker (~> 0.0, >= 0.0.3)
101
- equalizer (~> 0.0, >= 0.0.9)
102
- yard (0.9.12)
103
-
104
- PLATFORMS
105
- ruby
106
-
107
- DEPENDENCIES
108
- httpclient (>= 2.5.3.3)
109
- jeweler
110
- pry
111
- rdoc
112
- reek
113
- rspec
114
- simplecov
115
- yard (~> 0.9.11)
116
-
117
- BUNDLED WITH
118
- 1.16.1
data/examples/pv-check.rb DELETED
@@ -1,9 +0,0 @@
1
- require 'authy' # gem install authy
2
-
3
- Authy.api_url = "https://api.authy.com"
4
- Authy.api_key = "[YOUR_API_KEY]"
5
-
6
- response = Authy::PhoneVerification.check(verification_code: "1234", country_code: [YOUR_COUNTRY_CODE], phone_number: "[YOUR_PHONE_NUMBER]")
7
- if response.ok?
8
- # verification was started
9
- end
data/examples/pv.rb DELETED
@@ -1,12 +0,0 @@
1
- require 'authy' # gem install authy
2
-
3
- Authy.api_url = "https://api.authy.com"
4
- Authy.api_key = "[YOUR_API_KEY]"
5
-
6
- # Custom Code example
7
- # response = Authy::PhoneVerification.start(via: "sms", country_code: 1, phone_number: "[YOUR_NUMBER]", custom_code: "1234")
8
-
9
- response = Authy::PhoneVerification.start(via: "sms", country_code: [YOUR_COUNTRY_CODE], phone_number: "[YOUR_PHONE_NUMBER]")
10
- if response.ok?
11
- # verification was started
12
- end
@@ -1,26 +0,0 @@
1
- class Hash
2
- def self.try_convert(value)
3
- return value if value.instance_of?(Hash)
4
- return nil if !value.respond_to?(:to_hash)
5
- converted = value.to_hash
6
- return converted if converted.instance_of?(Hash)
7
-
8
- cname = value.class.name
9
- raise TypeError, "can't convert %s to %s (%s#%s gives %s)" %
10
- [cname, Hash.name, cname, :to_hash, converted.class.name]
11
- end unless Hash.respond_to?(:try_convert)
12
- end
13
-
14
- class Array
15
- def self.try_convert(value)
16
- return value if value.instance_of?(Array)
17
- return nil if !value.respond_to?(:to_ary)
18
- converted = value.to_ary
19
- return converted if converted.instance_of?(Array)
20
-
21
- cname = value.class.name
22
- raise TypeError, "can't convert %s to %s (%s#%s gives %s)" %
23
- [cname, Array.name, cname, :to_ary, converted.class.name]
24
- end unless Array.respond_to?(:try_convert)
25
- end
26
-
@@ -1,23 +0,0 @@
1
- module Authy
2
- class PhoneIntelligence < Authy::API
3
-
4
- # @deprecated
5
- def self.verification_start(params)
6
- warn "[DEPRECATION] `PhoneIntelligence.verification_start` is deprecated. Please use `PhoneVerification.start` instead."
7
- Authy::PhoneVerification.start(params)
8
- end
9
-
10
- # @deprecated
11
- def self.verification_check(params)
12
- warn "[DEPRECATION] `PhoneIntelligence.verification_check` is deprecated. Please use `PhoneVerification.check` instead."
13
- Authy::PhoneVerification.check(params)
14
- end
15
-
16
- # options:
17
- # :country_code Numeric calling country code of the country.
18
- # :phone_number The persons phone number.
19
- def self.info(params)
20
- get_request("protected/json/phones/info", params)
21
- end
22
- end
23
- end
@@ -1,94 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Authy::PhoneIntelligence" do
4
- describe "Sending the verification code" do
5
-
6
- it "should send the code via SMS" do
7
- pending("API is not returning expected response in this case. The test phone number is invalid.")
8
- response = Authy::PhoneIntelligence.verification_start(
9
- via: "sms",
10
- country_code: "1",
11
- phone_number: "111-111-1111"
12
- )
13
-
14
- expect(response).to be_kind_of(Authy::Response)
15
- expect(response).to be_ok
16
- expect(response.message).to eq "Text message sent to +1 111-111-1111."
17
- end
18
-
19
- # it "should send the code via CALL" do
20
- # response = Authy::PhoneIntelligence.verification_start(
21
- # via: "call",
22
- # country_code: "1",
23
- # phone_number: "111-111-1111"
24
- # )
25
-
26
- # response.should be_kind_of(Authy::Response)
27
- # response.success.should be_truthy
28
- # response.message.should == "Text message sent to +1 111-111-1111."
29
- # end
30
- end
31
-
32
- describe "validate the fields required" do
33
- it "should return an error. Country code is required" do
34
- response = Authy::PhoneIntelligence.verification_start(
35
- via: "sms",
36
- phone_number: "111-111-1111"
37
- )
38
-
39
- expect(response).to_not be_ok
40
- expect(response.errors['message']).to match(/country_code - Parameter is required/)
41
- end
42
-
43
- it "should return an error. Cellphone is invalid" do
44
- response = Authy::PhoneIntelligence.verification_start(
45
- via: "sms",
46
- country_code: "1",
47
- phone_number: "123"
48
- )
49
-
50
- expect(response).to_not be_ok
51
- expect(response.errors['message']).to match(/Phone number is invalid/)
52
- end
53
- end
54
-
55
- describe "Check the verification code" do
56
- it "should return success true if code is correct" do
57
- pending("API is not returning expected response in this case. The test phone number is invalid.")
58
-
59
- response = Authy::PhoneIntelligence.verification_check(
60
- country_code: "1",
61
- phone_number: "111-111-1111",
62
- verification_code: "0000"
63
- )
64
-
65
- expect(response).to be_ok
66
- expect(response.message).to eq "Verification code is correct."
67
- end
68
-
69
- it "should return an error if code is incorrect" do
70
- pending("API is not returning expected response in this case. The test phone number is invalid.")
71
-
72
- response = Authy::PhoneIntelligence.verification_check(
73
- country_code: "1",
74
- phone_number: "111-111-1111",
75
- verification_code: "1234"
76
- )
77
-
78
- expect(response).to_not be_ok
79
- expect(response.message).to eq 'Verification code is incorrect.'
80
- end
81
- end
82
-
83
- describe "Requesting phone number information" do
84
- it "should return the phone information" do
85
- response = Authy::PhoneIntelligence.info(
86
- country_code: '1',
87
- phone_number: '7754615609'
88
- )
89
-
90
- expect(response).to be_ok
91
- expect(response.message).to match(/Phone number information as of/)
92
- end
93
- end
94
- end