onfido 2.4.0 → 2.5.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: c94c63515711a15cc138b42a1121f9e1e5d023a1bc40419502c8aa11cd8f3a23
4
- data.tar.gz: 6868c52e39f8cc35ec28acd396cb0cc94f63093fe6a1c773891cf8d6170dd8fd
3
+ metadata.gz: 3a735bab9e701c74ac67467bc518ddbf0c2cabf9a7dea65744fe497cac937ef6
4
+ data.tar.gz: b93c799294c06f6dcfc63f0973f896ef7090688219bd09e2bcf257b8a4f6fee1
5
5
  SHA512:
6
- metadata.gz: a21c2254adb0f552b319a26dc4916415c8c4a74e5681c51ee95084aa01e77b3ec72816b47f9d8bfbf0f89b24c5f2f4796fc6e38f45cce184b9ad035ff6c42339
7
- data.tar.gz: bf96b5f01ff6acf63b2e7534a0047759415c7a2c08d45f43c95b525efbded114ceb88c97171c385a7073a87483aed74801b7db9f6f849a27a7fe6330bb704b90
6
+ metadata.gz: b95258294942d7f46c1c6614b3fbb73c27ad3b37d6b4f4fa8360b80b25e3744ab6c4db62892c258bedbcf99a9c699dc2e860b8439af53d28d2fbf2790d611fe1
7
+ data.tar.gz: 2c52abc70d6022a2a1e10fe02e413920fefea32eb6a6ef7e0b7cd0f5bb618ad5013b7733e722f99800e42b0f0fe40331b43061716fdb3402d5149ffe25faa744
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v2.5.0, 22 October 2022
2
+
3
+ - Added Motion capture support
4
+
1
5
  ## v2.4.0, 05 October 2022
2
6
 
3
7
  - 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,10 @@ module Onfido
26
26
  @live_video ||= Onfido::LiveVideo.new(options)
27
27
  end
28
28
 
29
+ def motion_capture
30
+ @motion_capture ||= Onfido::MotionCapture.new(options)
31
+ end
32
+
29
33
  def report
30
34
  @report ||= Onfido::Report.new(options)
31
35
  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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onfido
4
- VERSION = '2.4.0'
4
+ VERSION = '2.5.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/motion_capture'
23
24
  require 'onfido/resources/report'
24
25
  require 'onfido/resources/sdk_token'
25
26
  require 'onfido/resources/webhook'
@@ -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,30 @@ class FakeOnfidoAPI < Sinatra::Base # rubocop:disable Metrics/ClassLength
114
114
  "\x01\x02\x03" # acts as binary file data
115
115
  end
116
116
 
117
+ get '/v3.5/motion_captures/:id' do
118
+ json_response(200, 'motion_capture.json')
119
+ end
120
+
121
+ get '/v3.5/motion_captures' do
122
+ if params['applicant_id'] == '1030303-123123-123123'
123
+ json_response(200, 'motion_captures.json')
124
+ else
125
+ status 404
126
+ end
127
+ end
128
+
129
+ get '/v3.5/motion_captures/:id/download' do
130
+ status 200
131
+ content_type 'video/mp4'
132
+ "\x01\x02\x03" # acts as binary file data
133
+ end
134
+
135
+ get '/v3.5/motion_captures/:id/frame' do
136
+ status 200
137
+ content_type 'image/jpeg'
138
+ "\x01\x02\x03" # acts as binary file data
139
+ end
140
+
117
141
  post '/v3.5/checks' do
118
142
  params['applicant_id'].nil? ? status(422) : json_response(201, 'check.json')
119
143
  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.0
4
+ version: 2.5.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-11 00:00:00.000000000 Z
11
+ date: 2022-11-29 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/motion_capture.rb
144
145
  - lib/onfido/resources/report.rb
145
146
  - lib/onfido/resources/sdk_token.rb
146
147
  - lib/onfido/resources/webhook.rb
@@ -153,6 +154,7 @@ files:
153
154
  - spec/integrations/extraction_spec.rb
154
155
  - spec/integrations/live_photo_spec.rb
155
156
  - spec/integrations/live_video_spec.rb
157
+ - spec/integrations/motion_capture_spec.rb
156
158
  - spec/integrations/report_spec.rb
157
159
  - spec/integrations/resource_spec.rb
158
160
  - spec/integrations/sdk_token_spec.rb
@@ -176,6 +178,8 @@ files:
176
178
  - spec/support/fixtures/live_photos.json
177
179
  - spec/support/fixtures/live_video.json
178
180
  - spec/support/fixtures/live_videos.json
181
+ - spec/support/fixtures/motion_capture.json
182
+ - spec/support/fixtures/motion_captures.json
179
183
  - spec/support/fixtures/not_scheduled_for_deletion_error.json
180
184
  - spec/support/fixtures/report.json
181
185
  - spec/support/fixtures/reports.json
@@ -214,6 +218,7 @@ test_files:
214
218
  - spec/integrations/extraction_spec.rb
215
219
  - spec/integrations/live_photo_spec.rb
216
220
  - spec/integrations/live_video_spec.rb
221
+ - spec/integrations/motion_capture_spec.rb
217
222
  - spec/integrations/report_spec.rb
218
223
  - spec/integrations/resource_spec.rb
219
224
  - spec/integrations/sdk_token_spec.rb
@@ -237,6 +242,8 @@ test_files:
237
242
  - spec/support/fixtures/live_photos.json
238
243
  - spec/support/fixtures/live_video.json
239
244
  - spec/support/fixtures/live_videos.json
245
+ - spec/support/fixtures/motion_capture.json
246
+ - spec/support/fixtures/motion_captures.json
240
247
  - spec/support/fixtures/not_scheduled_for_deletion_error.json
241
248
  - spec/support/fixtures/report.json
242
249
  - spec/support/fixtures/reports.json