onfido 0.11.0 → 0.12.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: 25182eb1c80a27c7f3fbd914c640e277e973e71d0f24f8760c4c28894b243622
4
- data.tar.gz: 9f2a71605568b28890ac8ad6113050a9f6e2a947e19964a70a2144fe51571e93
3
+ metadata.gz: 8db5e90cf91e9eebbeed0ecb56e8e2940c430fa8ea742a5eef3959bafa3cec16
4
+ data.tar.gz: 995f57f45b8c0109499b8167edf6ecc6b9212c5c0391676338ef3f23e5539361
5
5
  SHA512:
6
- metadata.gz: 16f99cd52f76371e5fee1aef34d0c33752eb772ae6ffbd514644ee84eb5baf50fb126d4a00726fe7b15f802f8efbc7f3ff3a654bae875a0af992cfac6663d63b
7
- data.tar.gz: e1df5fd7ca79a84cd33942d59271b68ccedaca41d49dfdf1ef107a07d199e8688299da824c7d32722a1350f6137c7bfd5ad3907449e5a93ec28f2d288d137edd
6
+ metadata.gz: 3f506b59b42c1b5639a402d369f99aee0bc9f59a9036c2257c0209c431e7a487b0b6e961a17b966c8ea0f928241c148233a0424b36b8fed4b04d91793722f961
7
+ data.tar.gz: 72f1c306e8b8dc23e3d669f8968af77f319a7c46539aa8d2f4407b18bdbb2baafabb292bafd61211f249067deb8a56ad3d0d44ff3c78d78f05fcd6069dd43022
@@ -1,3 +1,7 @@
1
+ ## v0.12.0, 29 May 2018
2
+
3
+ - Add support for the Live Video resource (#55) (@Intrepidd)
4
+
1
5
  ## v0.11.0, 18 April 2018
2
6
 
3
7
  - Automatically detect the correct Onfido API region to use based on the provided API
data/README.md CHANGED
@@ -12,7 +12,7 @@ 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.11.0'
15
+ gem 'onfido', '~> 0.12.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.
@@ -17,6 +17,7 @@ require 'onfido/resources/applicant'
17
17
  require 'onfido/resources/check'
18
18
  require 'onfido/resources/document'
19
19
  require 'onfido/resources/live_photo'
20
+ require 'onfido/resources/live_video'
20
21
  require 'onfido/resources/report'
21
22
  require 'onfido/resources/report_type_group'
22
23
  require 'onfido/resources/sdk_token'
@@ -20,6 +20,10 @@ module Onfido
20
20
  Onfido::LivePhoto.new(@api_key)
21
21
  end
22
22
 
23
+ def live_video
24
+ Onfido::LiveVideo.new(@api_key)
25
+ end
26
+
23
27
  def report
24
28
  Onfido::Report.new(@api_key)
25
29
  end
@@ -0,0 +1,18 @@
1
+ module Onfido
2
+ class LiveVideo < Resource
3
+ def find(applicant_id, live_video_id)
4
+ query_string = "applicant_id=#{applicant_id}"
5
+ get(url: url_for("live_videos/#{live_video_id}?#{query_string}"))
6
+ end
7
+
8
+ def download(applicant_id, live_video_id)
9
+ query_string = "applicant_id=#{applicant_id}"
10
+ get(url: url_for("live_videos/#{live_video_id}/download?#{query_string}"))
11
+ end
12
+
13
+ def all(applicant_id)
14
+ query_string = "applicant_id=#{applicant_id}"
15
+ get(url: url_for("live_videos?#{query_string}"))
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Onfido
2
- VERSION = '0.11.0'.freeze
2
+ VERSION = '0.12.0'.freeze
3
3
  end
@@ -0,0 +1,34 @@
1
+ require 'tempfile'
2
+
3
+ describe Onfido::LiveVideo do
4
+ subject(:live_video) { described_class.new }
5
+
6
+ describe '#find' do
7
+ let(:applicant_id) { '1030303-123123-123123' }
8
+ let(:live_video_id) { 'c9701e9b-83aa-442f-995b-20320ee8fb01' }
9
+
10
+ it 'returns the expected live photo' do
11
+ response = live_video.find(applicant_id, live_video_id)
12
+ expect(response['id']).to eq(live_video_id)
13
+ end
14
+ end
15
+
16
+ describe '#all' do
17
+ let(:applicant_id) { '1030303-123123-123123' }
18
+
19
+ it 'returns list of documents' do
20
+ response = live_video.all(applicant_id)
21
+ expect(response['live_videos']).not_to be_empty
22
+ end
23
+ end
24
+
25
+ describe '#download' do
26
+ let(:applicant_id) { '1030303-123123-123123' }
27
+ let(:live_video_id) { 'c9701e9b-83aa-442f-995b-20320ee8fb01' }
28
+
29
+ it 'returns the file data' do
30
+ response = live_video.download(applicant_id, live_video_id)
31
+ expect(response).not_to be_nil
32
+ end
33
+ end
34
+ end
@@ -74,6 +74,32 @@ class FakeOnfidoAPI < Sinatra::Base
74
74
  end
75
75
  end
76
76
 
77
+ get '/v2/live_videos/:id' do
78
+ if params["applicant_id"] != "1030303-123123-123123"
79
+ status 404
80
+ else
81
+ json_response(200, 'live_video.json')
82
+ end
83
+ end
84
+
85
+ get '/v2/live_videos' do
86
+ if params["applicant_id"] != "1030303-123123-123123"
87
+ status 404
88
+ else
89
+ json_response(200, 'live_videos.json')
90
+ end
91
+ end
92
+
93
+ get '/v2/live_videos/:id/download' do
94
+ if params["applicant_id"] != "1030303-123123-123123"
95
+ status 404
96
+ else
97
+ status 200
98
+ content_type 'video/quicktime'
99
+ "\x01\x02\x03" # acts as binary file data
100
+ end
101
+ end
102
+
77
103
  post '/v2/applicants/:id/checks' do
78
104
  json_response(201, 'check.json')
79
105
  end
@@ -0,0 +1,23 @@
1
+ {
2
+ "id" : "c9701e9b-83aa-442f-995b-20320ee8fb01",
3
+ "challenge" : [
4
+ {
5
+ "type" : "movement",
6
+ "query" : "turnLeft"
7
+ },
8
+ {
9
+ "type" : "recite",
10
+ "query" : [
11
+ 9,
12
+ 5,
13
+ 9
14
+ ]
15
+ }
16
+ ],
17
+ "created_at" : "2018-05-29T09:00:39Z",
18
+ "file_name" : "output-29-05-2018_11_00_24.mov",
19
+ "file_type" : "video/quicktime",
20
+ "file_size" : 3348421,
21
+ "href" : "/v2/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01",
22
+ "download_href" : "/v2/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01/download"
23
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "live_videos": [
3
+ {
4
+ "challenge": [
5
+ {
6
+ "query": "turnLeft",
7
+ "type": "movement"
8
+ },
9
+ {
10
+ "query": [
11
+ 9,
12
+ 5,
13
+ 9
14
+ ],
15
+ "type": "recite"
16
+ }
17
+ ],
18
+ "created_at": "2018-05-29T09:00:39Z",
19
+ "download_href": "/v2/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01/download",
20
+ "file_name": "output-29-05-2018_11_00_24.mov",
21
+ "file_size": 3348421,
22
+ "file_type": "video/quicktime",
23
+ "href": "/v2/live_videos/c9701e9b-83aa-442f-995b-20320ee8fb01",
24
+ "id": "c9701e9b-83aa-442f-995b-20320ee8fb01"
25
+ }
26
+ ]
27
+ }
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.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pericles Theodorou
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-04-18 00:00:00.000000000 Z
12
+ date: 2018-05-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -170,6 +170,7 @@ files:
170
170
  - lib/onfido/resources/check.rb
171
171
  - lib/onfido/resources/document.rb
172
172
  - lib/onfido/resources/live_photo.rb
173
+ - lib/onfido/resources/live_video.rb
173
174
  - lib/onfido/resources/report.rb
174
175
  - lib/onfido/resources/report_type_group.rb
175
176
  - lib/onfido/resources/sdk_token.rb
@@ -182,6 +183,7 @@ files:
182
183
  - spec/integrations/document_spec.rb
183
184
  - spec/integrations/exceptions_spec.rb
184
185
  - spec/integrations/live_photo_spec.rb
186
+ - spec/integrations/live_video_spec.rb
185
187
  - spec/integrations/report_spec.rb
186
188
  - spec/integrations/report_type_group_spec.rb
187
189
  - spec/integrations/sdk_token_spec.rb
@@ -205,6 +207,8 @@ files:
205
207
  - spec/support/fixtures/documents.json
206
208
  - spec/support/fixtures/live_photo.json
207
209
  - spec/support/fixtures/live_photos.json
210
+ - spec/support/fixtures/live_video.json
211
+ - spec/support/fixtures/live_videos.json
208
212
  - spec/support/fixtures/report.json
209
213
  - spec/support/fixtures/report_type_group.json
210
214
  - spec/support/fixtures/report_type_groups.json
@@ -244,6 +248,7 @@ test_files:
244
248
  - spec/integrations/document_spec.rb
245
249
  - spec/integrations/exceptions_spec.rb
246
250
  - spec/integrations/live_photo_spec.rb
251
+ - spec/integrations/live_video_spec.rb
247
252
  - spec/integrations/report_spec.rb
248
253
  - spec/integrations/report_type_group_spec.rb
249
254
  - spec/integrations/sdk_token_spec.rb
@@ -267,6 +272,8 @@ test_files:
267
272
  - spec/support/fixtures/documents.json
268
273
  - spec/support/fixtures/live_photo.json
269
274
  - spec/support/fixtures/live_photos.json
275
+ - spec/support/fixtures/live_video.json
276
+ - spec/support/fixtures/live_videos.json
270
277
  - spec/support/fixtures/report.json
271
278
  - spec/support/fixtures/report_type_group.json
272
279
  - spec/support/fixtures/report_type_groups.json