onfido 2.4.0 → 2.6.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 +8 -0
- data/lib/onfido/api.rb +8 -0
- data/lib/onfido/resources/monitor.rb +24 -0
- data/lib/onfido/resources/motion_capture.rb +21 -0
- data/lib/onfido/version.rb +1 -1
- data/lib/onfido.rb +2 -0
- data/spec/integrations/monitor_spec.rb +40 -0
- data/spec/integrations/motion_capture_spec.rb +44 -0
- data/spec/support/fake_onfido_api.rb +44 -0
- data/spec/support/fixtures/monitor.json +8 -0
- data/spec/support/fixtures/monitors.json +12 -0
- data/spec/support/fixtures/motion_capture.json +9 -0
- data/spec/support/fixtures/motion_captures.json +13 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74a5e178fa210205846555dbb0f870b21830bae9a44bbf36bd2f095f4c12bc7e
|
4
|
+
data.tar.gz: 605d4d740f4a73db842ca05592d34d1170e565ccbc5ee2c580a1f131968673fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e31930f8a4e9a856e72753420801ada047f159ae6444648440cde21008270f068ccce793974c5361cd26f538ec51b52ceb2a76ea63af2249629e8d27c056ca8f
|
7
|
+
data.tar.gz: 03dd7a20bb4d1e6fcad6b1f9a3a79c1238bc2e966395f35bb4509ce5987f10eb1d602a2327f19a15bad558be1491d9f3f2137022785909352a5c028f8c9f6e99
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## v2.6.0, 22 November 2022
|
2
|
+
|
3
|
+
- Added support for [Monitors](https://documentation.onfido.com/#monitors)
|
4
|
+
|
5
|
+
## v2.5.0, 22 October 2022
|
6
|
+
|
7
|
+
- Added Motion capture support
|
8
|
+
|
1
9
|
## v2.4.0, 05 October 2022
|
2
10
|
|
3
11
|
- Updated to use API v3.5, for more details please see our [release notes](https://developers.onfido.com/release-notes#api-v35).
|
data/lib/onfido/api.rb
CHANGED
@@ -26,6 +26,14 @@ module Onfido
|
|
26
26
|
@live_video ||= Onfido::LiveVideo.new(options)
|
27
27
|
end
|
28
28
|
|
29
|
+
def monitor
|
30
|
+
@monitor ||= Onfido::Monitor.new(options)
|
31
|
+
end
|
32
|
+
|
33
|
+
def motion_capture
|
34
|
+
@motion_capture ||= Onfido::MotionCapture.new(options)
|
35
|
+
end
|
36
|
+
|
29
37
|
def report
|
30
38
|
@report ||= Onfido::Report.new(options)
|
31
39
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Onfido
|
4
|
+
class Monitor < Resource
|
5
|
+
def create(applicant_id:, report_name:, **payload)
|
6
|
+
payload[:applicant_id] = applicant_id
|
7
|
+
payload[:report_name] = report_name
|
8
|
+
|
9
|
+
post(path: 'watchlist_monitors', payload: payload)
|
10
|
+
end
|
11
|
+
|
12
|
+
def find(monitor_id)
|
13
|
+
get(path: "watchlist_monitors/#{monitor_id}")
|
14
|
+
end
|
15
|
+
|
16
|
+
def all(applicant_id)
|
17
|
+
get(path: "watchlist_monitors?applicant_id=#{applicant_id}")
|
18
|
+
end
|
19
|
+
|
20
|
+
def destroy(monitor_id)
|
21
|
+
delete(path: "watchlist_monitors/#{monitor_id}")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Onfido
|
4
|
+
class MotionCapture < Resource
|
5
|
+
def find(motion_capture_id)
|
6
|
+
get(path: "motion_captures/#{motion_capture_id}")
|
7
|
+
end
|
8
|
+
|
9
|
+
def download(motion_capture_id)
|
10
|
+
get(path: "motion_captures/#{motion_capture_id}/download")
|
11
|
+
end
|
12
|
+
|
13
|
+
def frame(motion_capture_id)
|
14
|
+
get(path: "motion_captures/#{motion_capture_id}/frame")
|
15
|
+
end
|
16
|
+
|
17
|
+
def all(applicant_id)
|
18
|
+
get(path: "motion_captures?applicant_id=#{applicant_id}")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/onfido/version.rb
CHANGED
data/lib/onfido.rb
CHANGED
@@ -20,6 +20,8 @@ require 'onfido/resources/document'
|
|
20
20
|
require 'onfido/resources/extraction'
|
21
21
|
require 'onfido/resources/live_photo'
|
22
22
|
require 'onfido/resources/live_video'
|
23
|
+
require 'onfido/resources/monitor'
|
24
|
+
require 'onfido/resources/motion_capture'
|
23
25
|
require 'onfido/resources/report'
|
24
26
|
require 'onfido/resources/sdk_token'
|
25
27
|
require 'onfido/resources/webhook'
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe Onfido::Monitor do
|
4
|
+
include_context 'fake onfido api'
|
5
|
+
|
6
|
+
subject(:monitor) { onfido.monitor }
|
7
|
+
|
8
|
+
let(:monitor_id) { '2748c4fc-c6b8-4c1e-a383-21efa241ce1e' }
|
9
|
+
|
10
|
+
describe '#create' do
|
11
|
+
let(:applicant_id) { '61f659cb-c90b-4067-808a-6136b5c01351' }
|
12
|
+
let(:report_name) { 'watchlist_standard' }
|
13
|
+
|
14
|
+
it 'creates a monitor for the applicant' do
|
15
|
+
response = monitor.create(applicant_id: applicant_id, report_name: report_name)
|
16
|
+
expect(response).to be_a(Hash).and include('id' => monitor_id, 'report_name' => report_name)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#find' do
|
21
|
+
it 'returns the expected monitor' do
|
22
|
+
response = monitor.find(monitor_id)
|
23
|
+
|
24
|
+
expect(response).to be_a(Hash).and include('id' => monitor_id)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#all' do
|
29
|
+
it 'returns a list of monitors' do
|
30
|
+
applicant_id = '1030303-123123-123123'
|
31
|
+
response = monitor.all(applicant_id)
|
32
|
+
|
33
|
+
expect(response['monitors']).to be_an(Array).and contain_exactly(an_instance_of(Hash))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'returns success code' do
|
38
|
+
expect { monitor.destroy(monitor_id) }.not_to raise_error
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'tempfile'
|
4
|
+
|
5
|
+
describe Onfido::MotionCapture do
|
6
|
+
include_context 'fake onfido api'
|
7
|
+
|
8
|
+
subject(:motion_capture) { onfido.motion_capture }
|
9
|
+
|
10
|
+
let(:motion_capture_id) { 'b1ae05b7-fb12-47c3-971c-311b56fc8de6' }
|
11
|
+
|
12
|
+
describe '#find' do
|
13
|
+
it 'returns the expected motion capture' do
|
14
|
+
response = motion_capture.find(motion_capture_id)
|
15
|
+
|
16
|
+
expect(response['id']).to eq(motion_capture_id)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe '#all' do
|
21
|
+
it 'returns list of motion captures' do
|
22
|
+
applicant_id = '1030303-123123-123123'
|
23
|
+
response = motion_capture.all(applicant_id)
|
24
|
+
|
25
|
+
expect(response['motion_captures']).not_to be_empty
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#download' do
|
30
|
+
it 'returns the file data' do
|
31
|
+
response = motion_capture.download(motion_capture_id)
|
32
|
+
|
33
|
+
expect(response).not_to be_nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '#frame' do
|
38
|
+
it 'returns the frame data' do
|
39
|
+
response = motion_capture.frame(motion_capture_id)
|
40
|
+
|
41
|
+
expect(response).not_to be_nil
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -114,6 +114,50 @@ class FakeOnfidoAPI < Sinatra::Base # rubocop:disable Metrics/ClassLength
|
|
114
114
|
"\x01\x02\x03" # acts as binary file data
|
115
115
|
end
|
116
116
|
|
117
|
+
post '/v3.5/watchlist_monitors' do
|
118
|
+
json_response(201, 'monitor.json')
|
119
|
+
end
|
120
|
+
|
121
|
+
get '/v3.5/watchlist_monitors/:id' do
|
122
|
+
json_response(200, 'monitor.json')
|
123
|
+
end
|
124
|
+
|
125
|
+
get '/v3.5/watchlist_monitors' do
|
126
|
+
if params['applicant_id'] == '1030303-123123-123123'
|
127
|
+
json_response(200, 'monitors.json')
|
128
|
+
else
|
129
|
+
status 404
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
delete '/v3.5/watchlist_monitors/:id' do
|
134
|
+
status 204
|
135
|
+
end
|
136
|
+
|
137
|
+
get '/v3.5/motion_captures/:id' do
|
138
|
+
json_response(200, 'motion_capture.json')
|
139
|
+
end
|
140
|
+
|
141
|
+
get '/v3.5/motion_captures' do
|
142
|
+
if params['applicant_id'] == '1030303-123123-123123'
|
143
|
+
json_response(200, 'motion_captures.json')
|
144
|
+
else
|
145
|
+
status 404
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
get '/v3.5/motion_captures/:id/download' do
|
150
|
+
status 200
|
151
|
+
content_type 'video/mp4'
|
152
|
+
"\x01\x02\x03" # acts as binary file data
|
153
|
+
end
|
154
|
+
|
155
|
+
get '/v3.5/motion_captures/:id/frame' do
|
156
|
+
status 200
|
157
|
+
content_type 'image/jpeg'
|
158
|
+
"\x01\x02\x03" # acts as binary file data
|
159
|
+
end
|
160
|
+
|
117
161
|
post '/v3.5/checks' do
|
118
162
|
params['applicant_id'].nil? ? status(422) : json_response(201, 'check.json')
|
119
163
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
{
|
2
|
+
"id" : "b1ae05b7-fb12-47c3-971c-311b56fc8de6",
|
3
|
+
"created_at" : "2022-11-22T10:22:45Z",
|
4
|
+
"file_name" : "motion_capture.mp4",
|
5
|
+
"file_type" : "video/mp4",
|
6
|
+
"file_size" : 2437112,
|
7
|
+
"href" : "/v3.5/motion_captures/b1ae05b7-fb12-47c3-971c-311b56fc8de6",
|
8
|
+
"download_href" : "/v3.5/motion_captures/b1ae05b7-fb12-47c3-971c-311b56fc8de6/download"
|
9
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"motion_captures": [
|
3
|
+
{
|
4
|
+
"id" : "b1ae05b7-fb12-47c3-971c-311b56fc8de6",
|
5
|
+
"created_at" : "2022-11-22T10:22:45Z",
|
6
|
+
"file_name" : "motion_capture.mp4",
|
7
|
+
"file_type" : "video/mp4",
|
8
|
+
"file_size" : 2437112,
|
9
|
+
"href" : "/v3.5/motion_captures/b1ae05b7-fb12-47c3-971c-311b56fc8de6",
|
10
|
+
"download_href" : "/v3.5/motion_captures/b1ae05b7-fb12-47c3-971c-311b56fc8de6/download"
|
11
|
+
}
|
12
|
+
]
|
13
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onfido
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Onfido
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -141,6 +141,8 @@ files:
|
|
141
141
|
- lib/onfido/resources/extraction.rb
|
142
142
|
- lib/onfido/resources/live_photo.rb
|
143
143
|
- lib/onfido/resources/live_video.rb
|
144
|
+
- lib/onfido/resources/monitor.rb
|
145
|
+
- lib/onfido/resources/motion_capture.rb
|
144
146
|
- lib/onfido/resources/report.rb
|
145
147
|
- lib/onfido/resources/sdk_token.rb
|
146
148
|
- lib/onfido/resources/webhook.rb
|
@@ -153,6 +155,8 @@ files:
|
|
153
155
|
- spec/integrations/extraction_spec.rb
|
154
156
|
- spec/integrations/live_photo_spec.rb
|
155
157
|
- spec/integrations/live_video_spec.rb
|
158
|
+
- spec/integrations/monitor_spec.rb
|
159
|
+
- spec/integrations/motion_capture_spec.rb
|
156
160
|
- spec/integrations/report_spec.rb
|
157
161
|
- spec/integrations/resource_spec.rb
|
158
162
|
- spec/integrations/sdk_token_spec.rb
|
@@ -176,6 +180,10 @@ files:
|
|
176
180
|
- spec/support/fixtures/live_photos.json
|
177
181
|
- spec/support/fixtures/live_video.json
|
178
182
|
- spec/support/fixtures/live_videos.json
|
183
|
+
- spec/support/fixtures/monitor.json
|
184
|
+
- spec/support/fixtures/monitors.json
|
185
|
+
- spec/support/fixtures/motion_capture.json
|
186
|
+
- spec/support/fixtures/motion_captures.json
|
179
187
|
- spec/support/fixtures/not_scheduled_for_deletion_error.json
|
180
188
|
- spec/support/fixtures/report.json
|
181
189
|
- spec/support/fixtures/reports.json
|
@@ -214,6 +222,8 @@ test_files:
|
|
214
222
|
- spec/integrations/extraction_spec.rb
|
215
223
|
- spec/integrations/live_photo_spec.rb
|
216
224
|
- spec/integrations/live_video_spec.rb
|
225
|
+
- spec/integrations/monitor_spec.rb
|
226
|
+
- spec/integrations/motion_capture_spec.rb
|
217
227
|
- spec/integrations/report_spec.rb
|
218
228
|
- spec/integrations/resource_spec.rb
|
219
229
|
- spec/integrations/sdk_token_spec.rb
|
@@ -237,6 +247,10 @@ test_files:
|
|
237
247
|
- spec/support/fixtures/live_photos.json
|
238
248
|
- spec/support/fixtures/live_video.json
|
239
249
|
- spec/support/fixtures/live_videos.json
|
250
|
+
- spec/support/fixtures/monitor.json
|
251
|
+
- spec/support/fixtures/monitors.json
|
252
|
+
- spec/support/fixtures/motion_capture.json
|
253
|
+
- spec/support/fixtures/motion_captures.json
|
240
254
|
- spec/support/fixtures/not_scheduled_for_deletion_error.json
|
241
255
|
- spec/support/fixtures/report.json
|
242
256
|
- spec/support/fixtures/reports.json
|