onfido 0.13.0 → 0.14.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
- SHA1:
3
- metadata.gz: 4b61261e90bcef73d04ec7083f84be636932a17c
4
- data.tar.gz: cad7dae9a3f2be1a49b0ac66ba23203a98df84d4
2
+ SHA256:
3
+ metadata.gz: 27279800cfff5a840ce97b9e8de9dc74a5083ea1c57f8a10b87e5bc2950f1067
4
+ data.tar.gz: 922fdbde05fe24981a5e2cf6d6be173f6db0c8966521e07a7271c15df3849440
5
5
  SHA512:
6
- metadata.gz: 2c0d1cee16e88e9f0a926732ac58a06385b4455f543603007c75c86ec266267b5a003b90ce801fb15d46b6c025cf37a854b99a67863eaf232ed460450640ba5a
7
- data.tar.gz: 98b15700b77aaa1025892723195afac34902033b72e2e586186fe3b93e97984392a9a8f640cb72d4a91231244f772cf7ba8ee8075c698299f469d817d9dbb83f
6
+ metadata.gz: 0982bae64d5589a5909f03f92904445ea0f1912c554912a46893b61647756794522b11dbc46bb8e562712572c5459bd8f1a819e3e10d539bbbf6e5e7c077b5be
7
+ data.tar.gz: 8b741438cefff280b5ad6c1c6a7db958910f78553fd3e7315943a00247b6badc993154991c6866242dd2342eb31f8bc937904672fd4a01594f5feb1f454664d0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## v0.14.0, 28 Jan 2019
2
+
3
+ - Add support for applicant deletion and restore endpoints
4
+
5
+ ## v0.13.0, 5 Nov 2018
6
+
7
+ - Add support for region-specific environments (@stephencookdev)
8
+
1
9
  ## v0.12.0, 29 May 2018
2
10
 
3
11
  - Add support for the Live Video resource (#55) (@Intrepidd)
data/README.md CHANGED
@@ -12,14 +12,14 @@ 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.12.0'
15
+ gem 'onfido', '~> 0.13.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.
19
19
 
20
20
  ## Configuration
21
21
 
22
- There are 5 configuration options:
22
+ There are 6 configuration options:
23
23
 
24
24
  ```ruby
25
25
  Onfido.configure do |config|
@@ -28,9 +28,19 @@ Onfido.configure do |config|
28
28
  config.logger = Logger.new(STDOUT)
29
29
  config.open_timeout = 30
30
30
  config.read_timeout = 80
31
+ config.region = nil
31
32
  end
32
33
  ```
33
34
 
35
+ ### Regions
36
+
37
+ The gem will use the default region if no region is specified.
38
+
39
+ To specify the US region do:
40
+ `config.region = :us`
41
+
42
+ See https://documentation.onfido.com/#regions for supported regions.
43
+
34
44
  ## Usage
35
45
 
36
46
  You can make API calls by using an instance of the `API` class:
@@ -58,11 +68,15 @@ Applicants are the object upon which Onfido checks are performed.
58
68
  ```ruby
59
69
  api.applicant.create(params) # => Creates an applicant
60
70
  api.applicant.update('applicant_id', params) # => Updates an applicant
61
- api.applicant.destroy('applicant_id') # => Destroy an applicant
71
+ api.applicant.destroy('applicant_id') # => Schedule an applicant for deletion
72
+ api.applicant.restore('applicant_id') # => Restore an applicant scheduled for deletion
62
73
  api.applicant.find('applicant_id') # => Finds a single applicant
63
74
  api.applicant.all # => Returns all applicants
64
75
  ```
65
76
 
77
+ **Note:** Calling api.applicant.destroy adds the applicant and all associated documents, photos, videos, checks, and reports to the deletion queue. They will be deleted 20 days after the request is made. An applicant that is scheduled for deletion can be restored but applicants that have been permanently deleted cannot be restored.
78
+ See https://documentation.onfido.com/#delete-applicant for more information.
79
+
66
80
  #### Documents
67
81
 
68
82
  Documents provide supporting evidence for Onfido checks.
@@ -19,5 +19,9 @@ module Onfido
19
19
  def all(page: 1, per_page: 20)
20
20
  get(url: url_for("applicants?page=#{page}&per_page=#{per_page}"))
21
21
  end
22
+
23
+ def restore(applicant_id)
24
+ post(url: url_for("applicants/#{applicant_id}/restore"))
25
+ end
22
26
  end
23
27
  end
@@ -1,3 +1,3 @@
1
1
  module Onfido
2
- VERSION = '0.13.0'.freeze
2
+ VERSION = '0.14.0'.freeze
3
3
  end
@@ -97,4 +97,26 @@ describe Onfido::Applicant do
97
97
  end
98
98
  end
99
99
  end
100
+
101
+ describe '#restore' do
102
+ context 'an applicant scheduled for deletion' do
103
+ let(:applicant_id) { '61f659cb-c90b-4067-808a-6136b5c01351' }
104
+
105
+ it 'returns nil' do
106
+ expect(applicant.restore(applicant_id)).to be_nil
107
+ end
108
+ end
109
+
110
+ context 'an applicant not scheduled for deletion' do
111
+ let(:applicant_id) { 'a2fb9c62-ab10-4898-a8ec-342c4b552ad5' }
112
+
113
+ it 'returns an error' do
114
+ expect { applicant.restore(applicant_id) }.to raise_error { |error|
115
+ expect(error).to be_a(Onfido::RequestError)
116
+ expect(error.message).to eq('There was a validation error on this request')
117
+ expect(error.fields).to eq("Applicant #{applicant_id} is not scheduled for deletion")
118
+ }
119
+ end
120
+ end
121
+ end
100
122
  end
@@ -26,6 +26,14 @@ class FakeOnfidoAPI < Sinatra::Base
26
26
  status 204
27
27
  end
28
28
 
29
+ post '/v2/applicants/:id/restore' do
30
+ if params["id"] == "a2fb9c62-ab10-4898-a8ec-342c4b552ad5"
31
+ json_response(422, 'not_scheduled_for_deletion_error.json')
32
+ else
33
+ status 204
34
+ end
35
+ end
36
+
29
37
  post '/v2/applicants/:id/documents' do
30
38
  json_response(201, 'document.json')
31
39
  end
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.13.0
4
+ version: 0.14.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-11-08 00:00:00.000000000 Z
12
+ date: 2019-01-28 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
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
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.6.14
240
+ rubygems_version: 2.7.4
241
241
  signing_key:
242
242
  specification_version: 4
243
243
  summary: A wrapper for Onfido API