onfido 0.12.0 → 0.13.0

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
- SHA256:
3
- metadata.gz: 8db5e90cf91e9eebbeed0ecb56e8e2940c430fa8ea742a5eef3959bafa3cec16
4
- data.tar.gz: 995f57f45b8c0109499b8167edf6ecc6b9212c5c0391676338ef3f23e5539361
2
+ SHA1:
3
+ metadata.gz: 4b61261e90bcef73d04ec7083f84be636932a17c
4
+ data.tar.gz: cad7dae9a3f2be1a49b0ac66ba23203a98df84d4
5
5
  SHA512:
6
- metadata.gz: 3f506b59b42c1b5639a402d369f99aee0bc9f59a9036c2257c0209c431e7a487b0b6e961a17b966c8ea0f928241c148233a0424b36b8fed4b04d91793722f961
7
- data.tar.gz: 72f1c306e8b8dc23e3d669f8968af77f319a7c46539aa8d2f4407b18bdbb2baafabb292bafd61211f249067deb8a56ad3d0d44ff3c78d78f05fcd6069dd43022
6
+ metadata.gz: 2c0d1cee16e88e9f0a926732ac58a06385b4455f543603007c75c86ec266267b5a003b90ce801fb15d46b6c025cf37a854b99a67863eaf232ed460450640ba5a
7
+ data.tar.gz: 98b15700b77aaa1025892723195afac34902033b72e2e586186fe3b93e97984392a9a8f640cb72d4a91231244f772cf7ba8ee8075c698299f469d817d9dbb83f
data/.rubocop.yml CHANGED
@@ -2,9 +2,6 @@
2
2
 
3
3
  AllCops:
4
4
  DisplayCopNames: true
5
- Include:
6
- - Rakefile
7
- - lib/tasks/*.rake
8
5
  Exclude:
9
6
  - vendor/**/*
10
7
  - .*/**
data/.travis.yml CHANGED
@@ -16,3 +16,8 @@ rvm:
16
16
  script:
17
17
  - bundle exec rubocop
18
18
  - bundle exec rspec spec
19
+
20
+ # safelist
21
+ branches:
22
+ only:
23
+ - master
@@ -1,6 +1,10 @@
1
1
  module Onfido
2
2
  module Configuration
3
- attr_accessor :api_key, :open_timeout, :read_timeout, :api_version
3
+ REGION_HOSTS = {
4
+ us: "api.us.onfido.com"
5
+ }.freeze
6
+
7
+ attr_accessor :api_key, :region, :open_timeout, :read_timeout, :api_version
4
8
 
5
9
  def self.extended(base)
6
10
  base.reset
@@ -12,6 +16,7 @@ module Onfido
12
16
 
13
17
  def reset
14
18
  self.api_key = nil
19
+ self.region = nil
15
20
  self.open_timeout = 30
16
21
  self.read_timeout = 80
17
22
  self.api_version = 'v2'
@@ -30,22 +35,13 @@ module Onfido
30
35
  RestClient.log ||= NullLogger.new
31
36
  end
32
37
 
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
-
43
38
  def endpoint
44
- if region
45
- "https://api.#{region}.onfido.com/#{api_version}/"
46
- else
47
- "https://api.onfido.com/#{api_version}/"
39
+ region_host = region ? REGION_HOSTS[region.downcase.to_sym] : "api.onfido.com"
40
+ unless region_host
41
+ raise "The region \"#{region.downcase}\" is not currently supported"
48
42
  end
43
+
44
+ "https://#{region_host}/#{api_version}/"
49
45
  end
50
46
  end
51
47
  end
@@ -1,3 +1,3 @@
1
1
  module Onfido
2
- VERSION = '0.12.0'.freeze
2
+ VERSION = '0.13.0'.freeze
3
3
  end
data/onfido.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
2
 
3
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'onfido/version'
6
6
 
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.add_development_dependency 'rake', '~> 12.0'
28
28
  spec.add_development_dependency 'rspec', '~> 3.1'
29
29
  spec.add_development_dependency 'rspec-its', '~> 1.2'
30
- spec.add_development_dependency 'rubocop', '~> 0.52.0'
30
+ spec.add_development_dependency 'rubocop', '~> 0.57.0'
31
31
  spec.add_development_dependency 'sinatra', '~> 1.4'
32
32
  spec.add_development_dependency 'webmock', '~> 3.0'
33
33
 
data/spec/onfido_spec.rb CHANGED
@@ -35,17 +35,18 @@ describe Onfido do
35
35
  end
36
36
  end
37
37
 
38
- describe 'using a US API token' do
38
+ describe 'using the US region' do
39
39
  it 'should change endpoint' do
40
- onfido.api_key = "us_live_asdfghjkl1234567890qwertyuiop"
40
+ onfido.region = 'us'
41
41
  expect(onfido.endpoint).to eq('https://api.us.onfido.com/v2/')
42
42
  end
43
43
  end
44
44
 
45
- describe 'using a EU API token' do
45
+ describe 'using an unsupported region' do
46
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/')
47
+ onfido.region = 'de'
48
+ expect { onfido.endpoint }.
49
+ to raise_error('The region "de" is not currently supported')
49
50
  end
50
51
  end
51
52
 
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.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pericles Theodorou
@@ -9,132 +9,132 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-05-29 00:00:00.000000000 Z
12
+ date: 2018-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.7'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.7'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ~>
33
33
  - !ruby/object:Gem::Version
34
34
  version: '12.0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ~>
40
40
  - !ruby/object:Gem::Version
41
41
  version: '12.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ~>
47
47
  - !ruby/object:Gem::Version
48
48
  version: '3.1'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ~>
54
54
  - !ruby/object:Gem::Version
55
55
  version: '3.1'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rspec-its
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - ~>
61
61
  - !ruby/object:Gem::Version
62
62
  version: '1.2'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
69
  version: '1.2'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rubocop
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - "~>"
74
+ - - ~>
75
75
  - !ruby/object:Gem::Version
76
- version: 0.52.0
76
+ version: 0.57.0
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - "~>"
81
+ - - ~>
82
82
  - !ruby/object:Gem::Version
83
- version: 0.52.0
83
+ version: 0.57.0
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: sinatra
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - "~>"
88
+ - - ~>
89
89
  - !ruby/object:Gem::Version
90
90
  version: '1.4'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - "~>"
95
+ - - ~>
96
96
  - !ruby/object:Gem::Version
97
97
  version: '1.4'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: webmock
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - "~>"
102
+ - - ~>
103
103
  - !ruby/object:Gem::Version
104
104
  version: '3.0'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - "~>"
109
+ - - ~>
110
110
  - !ruby/object:Gem::Version
111
111
  version: '3.0'
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: rack
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - ">="
116
+ - - '>='
117
117
  - !ruby/object:Gem::Version
118
118
  version: 1.6.0
119
119
  type: :runtime
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - ">="
123
+ - - '>='
124
124
  - !ruby/object:Gem::Version
125
125
  version: 1.6.0
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: rest-client
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - "~>"
130
+ - - ~>
131
131
  - !ruby/object:Gem::Version
132
132
  version: '2.0'
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - "~>"
137
+ - - ~>
138
138
  - !ruby/object:Gem::Version
139
139
  version: '2.0'
140
140
  description: A thin wrapper for Onfido's API. This gem supports both v1 and v2 of
@@ -147,10 +147,10 @@ executables: []
147
147
  extensions: []
148
148
  extra_rdoc_files: []
149
149
  files:
150
- - ".gitignore"
151
- - ".rspec"
152
- - ".rubocop.yml"
153
- - ".travis.yml"
150
+ - .gitignore
151
+ - .rspec
152
+ - .rubocop.yml
153
+ - .travis.yml
154
154
  - CHANGELOG.md
155
155
  - Gemfile
156
156
  - LICENSE
@@ -227,17 +227,17 @@ require_paths:
227
227
  - lib
228
228
  required_ruby_version: !ruby/object:Gem::Requirement
229
229
  requirements:
230
- - - ">="
230
+ - - '>='
231
231
  - !ruby/object:Gem::Version
232
232
  version: 2.2.0
233
233
  required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  requirements:
235
- - - ">="
235
+ - - '>='
236
236
  - !ruby/object:Gem::Version
237
237
  version: '0'
238
238
  requirements: []
239
239
  rubyforge_project:
240
- rubygems_version: 2.7.4
240
+ rubygems_version: 2.6.14
241
241
  signing_key:
242
242
  specification_version: 4
243
243
  summary: A wrapper for Onfido API