onfido 2.8.0 → 2.9.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: 38b8a8f0808cfd6cd4df9d3853705ae0b432136e28d8a0cd8712c353f61a2063
4
- data.tar.gz: c205a16862973f2bfe582aae44e58f4aa6d36ebd31647535e7151104b798f8ee
3
+ metadata.gz: 45d3181950092e828fccc42002981dd8e4cd00b6ed0aa6759ff1875c2f61a407
4
+ data.tar.gz: 2bc94fbf53b402b33b176870fc07180dd0b5bbbdf23d574ee7c34c71a6ac2d2f
5
5
  SHA512:
6
- metadata.gz: 30a055206b8ac359f93f45584edd9a751390f381bc11caabdee05cf5b13f06c71a79388753ec6e680672c274b1fd08604334af75b9c4465cfab651d7e6f36e36
7
- data.tar.gz: 5a887ab3f679946ce049ad3b4ba4bf874c31f641d437019df2093fe8f734ebebc29f6cca15b2b730ac47d14480e1ce239107ac5a6ce3fa639a71c8c78494b373
6
+ metadata.gz: 154987a4c3daa1ecd4a8bb02b1deb59a7c8e8c3d5591d886b48f96a9e41702a22bdc4d00ef70e7b2b18b1c8fb2ee4674ce2db02226f9af21f8e01825bc208ebc
7
+ data.tar.gz: fc096f80c5cd8f32e8380532706bc9b37f89df16fd628821f7c2906947ad40125770aa17b39107e2832d1b1eed9931274f72577a5ad0d03cab97fcd0fdfcc1ec
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v2.9.0 24 November 2023
2
+
3
+ - Added `signed_evidence_file` method for WorkflowRuns
4
+
1
5
  ## v2.8.0, 24 January 2023
2
6
 
3
7
  - Updated to use API v3.6, for more details please see our [release notes](https://developers.onfido.com/release-notes#api-v36).
@@ -13,5 +13,9 @@ module Onfido
13
13
  def all(query_params = {})
14
14
  get(path: "workflow_runs?#{stringify_query_params(query_params)}")
15
15
  end
16
+
17
+ def evidence(workflow_run_id)
18
+ get(path: "workflow_runs/#{workflow_run_id}/signed_evidence_file")
19
+ end
16
20
  end
17
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onfido
4
- VERSION = '2.8.0'
4
+ VERSION = '2.9.0'
5
5
  end
@@ -38,9 +38,17 @@ describe Onfido::WorkflowRun do
38
38
 
39
39
  describe '#all' do
40
40
  it 'returns the workflow runs' do
41
- response = workflow_run.all({ page: 1, sort: "asc" })
41
+ response = workflow_run.all({ page: 1, sort: 'asc' })
42
42
 
43
43
  expect(response.count).to eq(2)
44
44
  end
45
45
  end
46
+
47
+ describe '#evidence' do
48
+ it 'returns the signed PDF' do
49
+ response = workflow_run.evidence(workflow_run_id)
50
+
51
+ expect(response[0..4]).to eq('%PDF-')
52
+ end
53
+ end
46
54
  end
@@ -11,7 +11,7 @@ end
11
11
  class FakeOnfidoAPI < Sinatra::Base # rubocop:disable Metrics/ClassLength
12
12
  before do
13
13
  begin
14
- if request.content_type == "application/json; charset=utf-8"
14
+ if request.content_type == 'application/json; charset=utf-8'
15
15
  body_parameters = JSON.parse(request.body.read)
16
16
  params.merge!(body_parameters) if body_parameters
17
17
  end
@@ -249,6 +249,10 @@ class FakeOnfidoAPI < Sinatra::Base # rubocop:disable Metrics/ClassLength
249
249
  json_response(200, 'workflow_run.json')
250
250
  end
251
251
 
252
+ get '/v3.6/workflow_runs/:id/signed_evidence_file' do
253
+ pdf_response(200, 'signed_workflow_run.pdf')
254
+ end
255
+
252
256
  get '/v3.6/workflow_runs' do
253
257
  json_response(200, 'workflow_runs.json')
254
258
  end
@@ -270,9 +274,17 @@ class FakeOnfidoAPI < Sinatra::Base # rubocop:disable Metrics/ClassLength
270
274
  private
271
275
 
272
276
  def json_response(response_code, file_name)
273
- content_type 'application/json; charset=utf-8'
277
+ fixture_response(response_code, file_name, 'application/json')
278
+ end
279
+
280
+ def fixture_response(response_code, file_name, custom_content_type)
281
+ content_type "#{custom_content_type}; charset=utf-8"
274
282
  status response_code
275
- File.open("#{File.dirname(__FILE__)}/fixtures/#{file_name}", 'rb').read
283
+ File.binread("#{File.dirname(__FILE__)}/fixtures/#{file_name}")
284
+ end
285
+
286
+ def pdf_response(response_code, file_name)
287
+ fixture_response(response_code, file_name, 'application/pdf')
276
288
  end
277
289
 
278
290
  def pagination_range
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.8.0
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Onfido
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-01 00:00:00.000000000 Z
11
+ date: 2023-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -191,6 +191,7 @@ files:
191
191
  - spec/support/fixtures/report.json
192
192
  - spec/support/fixtures/reports.json
193
193
  - spec/support/fixtures/sdk_token.json
194
+ - spec/support/fixtures/signed_workflow_run.pdf
194
195
  - spec/support/fixtures/unexpected_error_format.json
195
196
  - spec/support/fixtures/webhook.json
196
197
  - spec/support/fixtures/webhooks.json
@@ -262,6 +263,7 @@ test_files:
262
263
  - spec/support/fixtures/report.json
263
264
  - spec/support/fixtures/reports.json
264
265
  - spec/support/fixtures/sdk_token.json
266
+ - spec/support/fixtures/signed_workflow_run.pdf
265
267
  - spec/support/fixtures/unexpected_error_format.json
266
268
  - spec/support/fixtures/webhook.json
267
269
  - spec/support/fixtures/webhooks.json