onfido 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/onfido/api.rb +4 -0
- data/lib/onfido/resources/monitor.rb +24 -0
- data/lib/onfido/version.rb +1 -1
- data/lib/onfido.rb +1 -0
- data/spec/integrations/monitor_spec.rb +40 -0
- data/spec/support/fake_onfido_api.rb +20 -0
- data/spec/support/fixtures/monitor.json +8 -0
- data/spec/support/fixtures/monitors.json +12 -0
- metadata +9 -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
data/lib/onfido/api.rb
CHANGED
@@ -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
|
data/lib/onfido/version.rb
CHANGED
data/lib/onfido.rb
CHANGED
@@ -20,6 +20,7 @@ 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'
|
23
24
|
require 'onfido/resources/motion_capture'
|
24
25
|
require 'onfido/resources/report'
|
25
26
|
require 'onfido/resources/sdk_token'
|
@@ -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
|
@@ -114,6 +114,26 @@ 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
|
+
|
117
137
|
get '/v3.5/motion_captures/:id' do
|
118
138
|
json_response(200, 'motion_capture.json')
|
119
139
|
end
|
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,7 @@ 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
|
144
145
|
- lib/onfido/resources/motion_capture.rb
|
145
146
|
- lib/onfido/resources/report.rb
|
146
147
|
- lib/onfido/resources/sdk_token.rb
|
@@ -154,6 +155,7 @@ files:
|
|
154
155
|
- spec/integrations/extraction_spec.rb
|
155
156
|
- spec/integrations/live_photo_spec.rb
|
156
157
|
- spec/integrations/live_video_spec.rb
|
158
|
+
- spec/integrations/monitor_spec.rb
|
157
159
|
- spec/integrations/motion_capture_spec.rb
|
158
160
|
- spec/integrations/report_spec.rb
|
159
161
|
- spec/integrations/resource_spec.rb
|
@@ -178,6 +180,8 @@ files:
|
|
178
180
|
- spec/support/fixtures/live_photos.json
|
179
181
|
- spec/support/fixtures/live_video.json
|
180
182
|
- spec/support/fixtures/live_videos.json
|
183
|
+
- spec/support/fixtures/monitor.json
|
184
|
+
- spec/support/fixtures/monitors.json
|
181
185
|
- spec/support/fixtures/motion_capture.json
|
182
186
|
- spec/support/fixtures/motion_captures.json
|
183
187
|
- spec/support/fixtures/not_scheduled_for_deletion_error.json
|
@@ -218,6 +222,7 @@ test_files:
|
|
218
222
|
- spec/integrations/extraction_spec.rb
|
219
223
|
- spec/integrations/live_photo_spec.rb
|
220
224
|
- spec/integrations/live_video_spec.rb
|
225
|
+
- spec/integrations/monitor_spec.rb
|
221
226
|
- spec/integrations/motion_capture_spec.rb
|
222
227
|
- spec/integrations/report_spec.rb
|
223
228
|
- spec/integrations/resource_spec.rb
|
@@ -242,6 +247,8 @@ test_files:
|
|
242
247
|
- spec/support/fixtures/live_photos.json
|
243
248
|
- spec/support/fixtures/live_video.json
|
244
249
|
- spec/support/fixtures/live_videos.json
|
250
|
+
- spec/support/fixtures/monitor.json
|
251
|
+
- spec/support/fixtures/monitors.json
|
245
252
|
- spec/support/fixtures/motion_capture.json
|
246
253
|
- spec/support/fixtures/motion_captures.json
|
247
254
|
- spec/support/fixtures/not_scheduled_for_deletion_error.json
|