onfido 2.5.0 → 2.6.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
2
  SHA256:
3
- metadata.gz: 3a735bab9e701c74ac67467bc518ddbf0c2cabf9a7dea65744fe497cac937ef6
4
- data.tar.gz: b93c799294c06f6dcfc63f0973f896ef7090688219bd09e2bcf257b8a4f6fee1
3
+ metadata.gz: 74a5e178fa210205846555dbb0f870b21830bae9a44bbf36bd2f095f4c12bc7e
4
+ data.tar.gz: 605d4d740f4a73db842ca05592d34d1170e565ccbc5ee2c580a1f131968673fa
5
5
  SHA512:
6
- metadata.gz: b95258294942d7f46c1c6614b3fbb73c27ad3b37d6b4f4fa8360b80b25e3744ab6c4db62892c258bedbcf99a9c699dc2e860b8439af53d28d2fbf2790d611fe1
7
- data.tar.gz: 2c52abc70d6022a2a1e10fe02e413920fefea32eb6a6ef7e0b7cd0f5bb618ad5013b7733e722f99800e42b0f0fe40331b43061716fdb3402d5149ffe25faa744
6
+ metadata.gz: e31930f8a4e9a856e72753420801ada047f159ae6444648440cde21008270f068ccce793974c5361cd26f538ec51b52ceb2a76ea63af2249629e8d27c056ca8f
7
+ data.tar.gz: 03dd7a20bb4d1e6fcad6b1f9a3a79c1238bc2e966395f35bb4509ce5987f10eb1d602a2327f19a15bad558be1491d9f3f2137022785909352a5c028f8c9f6e99
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v2.6.0, 22 November 2022
2
+
3
+ - Added support for [Monitors](https://documentation.onfido.com/#monitors)
4
+
1
5
  ## v2.5.0, 22 October 2022
2
6
 
3
7
  - Added Motion capture support
data/lib/onfido/api.rb CHANGED
@@ -26,6 +26,10 @@ 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
+
29
33
  def motion_capture
30
34
  @motion_capture ||= Onfido::MotionCapture.new(options)
31
35
  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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onfido
4
- VERSION = '2.5.0'
4
+ VERSION = '2.6.0'
5
5
  end
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
@@ -0,0 +1,8 @@
1
+ {
2
+ "id": "2748c4fc-c6b8-4c1e-a383-21efa241ce1e",
3
+ "report_name": "watchlist_standard",
4
+ "created_at": "2022-09-01T15:01:36.921Z",
5
+ "deleted_at": null,
6
+ "sandbox": false,
7
+ "tags": []
8
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "monitors": [
3
+ {
4
+ "id": "2748c4fc-c6b8-4c1e-a383-21efa241ce1e",
5
+ "report_name": "watchlist_standard",
6
+ "created_at": "2022-09-01T15:01:36.921Z",
7
+ "deleted_at": null,
8
+ "sandbox": false,
9
+ "tags": []
10
+ }
11
+ ]
12
+ }
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.5.0
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-29 00:00:00.000000000 Z
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