onfido 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/onfido/configuration.rb +15 -1
- data/lib/onfido/version.rb +1 -1
- data/spec/onfido_spec.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25182eb1c80a27c7f3fbd914c640e277e973e71d0f24f8760c4c28894b243622
|
4
|
+
data.tar.gz: 9f2a71605568b28890ac8ad6113050a9f6e2a947e19964a70a2144fe51571e93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16f99cd52f76371e5fee1aef34d0c33752eb772ae6ffbd514644ee84eb5baf50fb126d4a00726fe7b15f802f8efbc7f3ff3a654bae875a0af992cfac6663d63b
|
7
|
+
data.tar.gz: e1df5fd7ca79a84cd33942d59271b68ccedaca41d49dfdf1ef107a07d199e8688299da824c7d32722a1350f6137c7bfd5ad3907449e5a93ec28f2d288d137edd
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -12,7 +12,7 @@ This gem supports both `v1` and `v2` of the Onfido API. Refer to Onfido's [API d
|
|
12
12
|
Add this line to your application's Gemfile:
|
13
13
|
|
14
14
|
```ruby
|
15
|
-
gem 'onfido', '~> 0.
|
15
|
+
gem 'onfido', '~> 0.11.0'
|
16
16
|
```
|
17
17
|
|
18
18
|
The gem is compatible with Ruby 2.2.0 and onwards. Earlier versions of Ruby have [reached end-of-life](https://www.ruby-lang.org/en/news/2017/04/01/support-of-ruby-2-1-has-ended/), are no longer supported and no longer receive security fixes.
|
data/lib/onfido/configuration.rb
CHANGED
@@ -30,8 +30,22 @@ module Onfido
|
|
30
30
|
RestClient.log ||= NullLogger.new
|
31
31
|
end
|
32
32
|
|
33
|
+
def region
|
34
|
+
return unless api_key
|
35
|
+
|
36
|
+
first_bit = api_key.split("_")[0]
|
37
|
+
|
38
|
+
return if %w(live test).include?(first_bit)
|
39
|
+
|
40
|
+
first_bit
|
41
|
+
end
|
42
|
+
|
33
43
|
def endpoint
|
34
|
-
|
44
|
+
if region
|
45
|
+
"https://api.#{region}.onfido.com/#{api_version}/"
|
46
|
+
else
|
47
|
+
"https://api.onfido.com/#{api_version}/"
|
48
|
+
end
|
35
49
|
end
|
36
50
|
end
|
37
51
|
end
|
data/lib/onfido/version.rb
CHANGED
data/spec/onfido_spec.rb
CHANGED
@@ -35,6 +35,27 @@ describe Onfido do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
describe 'using a US API token' do
|
39
|
+
it 'should change endpoint' do
|
40
|
+
onfido.api_key = "us_live_asdfghjkl1234567890qwertyuiop"
|
41
|
+
expect(onfido.endpoint).to eq('https://api.us.onfido.com/v2/')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe 'using a EU API token' do
|
46
|
+
it 'should change endpoint' do
|
47
|
+
onfido.api_key = "eu_live_asdfghjkl1234567890qwertyuiop"
|
48
|
+
expect(onfido.endpoint).to eq('https://api.eu.onfido.com/v2/')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'using an old API token' do
|
53
|
+
it 'should use old endpoint' do
|
54
|
+
onfido.api_key = "live_asdfghjkl1234567890qwertyuiop"
|
55
|
+
expect(onfido.endpoint).to eq('https://api.onfido.com/v2/')
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
38
59
|
describe '.logger' do
|
39
60
|
context 'when an option is passed' do
|
40
61
|
context 'when the option passed behaves like a logger' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onfido
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pericles Theodorou
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-04-
|
12
|
+
date: 2018-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|