onfido 2.6.0 → 2.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74a5e178fa210205846555dbb0f870b21830bae9a44bbf36bd2f095f4c12bc7e
4
- data.tar.gz: 605d4d740f4a73db842ca05592d34d1170e565ccbc5ee2c580a1f131968673fa
3
+ metadata.gz: e2e3f3ecb736185d8fb0227413d125caacad919d755a3a61d855783d525082f3
4
+ data.tar.gz: f553f828aaf8273067417fb62a62d34a4727f0632f677d1751da34fa611288ca
5
5
  SHA512:
6
- metadata.gz: e31930f8a4e9a856e72753420801ada047f159ae6444648440cde21008270f068ccce793974c5361cd26f538ec51b52ceb2a76ea63af2249629e8d27c056ca8f
7
- data.tar.gz: 03dd7a20bb4d1e6fcad6b1f9a3a79c1238bc2e966395f35bb4509ce5987f10eb1d602a2327f19a15bad558be1491d9f3f2137022785909352a5c028f8c9f6e99
6
+ metadata.gz: 11cc9bf7b6f06b93d5cf7b68c3d6982359f762b88d9d59d9069d52b02ba7498511de545a11ad78cea358f7d9fd724fc2dc554f044f0ff206a7dd91502922b821
7
+ data.tar.gz: 19bf65314bc21d5d989eeb1102ae32de7e930a3cb665aca5b849c5405b611061fd67adb7eaab1ad899904626ccfbf08c39ef4495e0f9a8d6f315cf3366af8ea8
@@ -15,9 +15,9 @@ jobs:
15
15
  steps:
16
16
  - uses: actions/checkout@v2
17
17
  - name: Set up Ruby 2.6
18
- uses: actions/setup-ruby@v1
18
+ uses: ruby/setup-ruby@v1
19
19
  with:
20
- ruby-version: 2.6.x
20
+ ruby-version: 2.6
21
21
 
22
22
  - name: Publish to RubyGems
23
23
  run: |
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v2.7.0, 22 November 2022
2
+
3
+ - Added support for [Workflow Runs](https://documentation.onfido.com/#workflow-runs)
4
+
1
5
  ## v2.6.0, 22 November 2022
2
6
 
3
7
  - Added support for [Monitors](https://documentation.onfido.com/#monitors)
data/lib/onfido/api.rb CHANGED
@@ -54,6 +54,10 @@ module Onfido
54
54
  @extraction ||= Onfido::Extraction.new(options)
55
55
  end
56
56
 
57
+ def workflow_run
58
+ @workflow_run ||= Onfido::WorkflowRun.new(options)
59
+ end
60
+
57
61
  private
58
62
 
59
63
  attr_reader :options
@@ -141,5 +141,9 @@ module Onfido
141
141
  raise ArgumentError, 'File must be a `File`-like object which responds to ' \
142
142
  '`#read` and `#path`'
143
143
  end
144
+
145
+ def stringify_query_params(hashed_params)
146
+ URI.encode_www_form_component(hashed_params.map{ |k,v| "#{k}=#{v}" }.join("&"))
147
+ end
144
148
  end
145
149
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Onfido
4
+ class WorkflowRun < Resource
5
+ def create(payload)
6
+ post(path: 'workflow_runs', payload: payload)
7
+ end
8
+
9
+ def find(workflow_run_id)
10
+ get(path: "workflow_runs/#{workflow_run_id}")
11
+ end
12
+
13
+ def all(query_params = {})
14
+ get(path: "workflow_runs?#{stringify_query_params(query_params)}")
15
+ end
16
+ end
17
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onfido
4
- VERSION = '2.6.0'
4
+ VERSION = '2.7.0'
5
5
  end
data/lib/onfido.rb CHANGED
@@ -25,6 +25,7 @@ require 'onfido/resources/motion_capture'
25
25
  require 'onfido/resources/report'
26
26
  require 'onfido/resources/sdk_token'
27
27
  require 'onfido/resources/webhook'
28
+ require 'onfido/resources/workflow_run'
28
29
 
29
30
  module Onfido
30
31
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe Onfido::WorkflowRun do
4
+ include_context 'fake onfido api'
5
+
6
+ subject(:workflow_run) { onfido.workflow_run }
7
+
8
+ let(:workflow_run_id) { 'fcb73186-0733-4f6f-9c57-d9d5ef979443' }
9
+ let(:params) do
10
+ {
11
+ 'a' => 'b'
12
+ }
13
+ end
14
+
15
+ describe '#create' do
16
+ it 'serializes the payload correctly' do
17
+ WebMock.after_request do |request_signature, _response|
18
+ if request_signature.uri.path == 'v3.5/workflow_run'
19
+ expect(Rack::Utils.parse_nested_query(request_signature.body))
20
+ .to eq(params)
21
+ end
22
+ end
23
+ end
24
+
25
+ it 'creates a workflow run' do
26
+ response = workflow_run.create(params)
27
+ expect(response['id']).not_to be_nil
28
+ end
29
+ end
30
+
31
+ describe '#find' do
32
+ it 'returns the workflow run' do
33
+ response = workflow_run.find(workflow_run_id)
34
+
35
+ expect(response['id']).to eq(workflow_run_id)
36
+ end
37
+ end
38
+
39
+ describe '#all' do
40
+ it 'returns the workflow runs' do
41
+ response = workflow_run.all({ page: 1, sort: "asc" })
42
+
43
+ expect(response.count).to eq(2)
44
+ end
45
+ end
46
+ end
@@ -216,6 +216,18 @@ class FakeOnfidoAPI < Sinatra::Base # rubocop:disable Metrics/ClassLength
216
216
  json_response(200, 'webhooks.json')
217
217
  end
218
218
 
219
+ post '/v3.5/workflow_runs' do
220
+ json_response(201, 'workflow_run.json')
221
+ end
222
+
223
+ get '/v3.5/workflow_runs/:id' do
224
+ json_response(200, 'workflow_run.json')
225
+ end
226
+
227
+ get '/v3.5/workflow_runs' do
228
+ json_response(200, 'workflow_runs.json')
229
+ end
230
+
219
231
  get '/v3.5/4xx_response' do
220
232
  json_response(422, '4xx_response.json')
221
233
  end
@@ -0,0 +1,20 @@
1
+ {
2
+ "id": "fcb73186-0733-4f6f-9c57-d9d5ef979443",
3
+ "applicant_id": "fcb73186-0733-4f6f-9c57-d9d5ef979443",
4
+ "workflow_id": "fcb73186-0733-4f6f-9c57-d9d5ef979443",
5
+ "workflow_version_id": 11,
6
+ "status": "approved",
7
+ "dashboard_url":"https://dashboard.onfido.com/results/fcb73186-0733-4f6f-9c57-d9d5ef979443",
8
+ "output": {"prop1": "val_1", "prop2": 10},
9
+ "reasons": ["reason_1", "reason_2"],
10
+ "error": null,
11
+ "created_at": "2022-06-28T15:39:42Z",
12
+ "updated_at": "2022-07-28T15:40:42Z",
13
+ "link": {
14
+ "completed_redirect_url": "https://example.onfido.com",
15
+ "expired_redirect_url": "https://example.onfido.com",
16
+ "expires_at": "2022-10-17T14:40:50Z",
17
+ "language": "en_US",
18
+ "url": "https://eu.onfido.app/l/fcb73186-0733-4f6f-9c57-d9d5ef979443"
19
+ }
20
+ }
@@ -0,0 +1,42 @@
1
+ [
2
+ {
3
+ "id": "fcb73186-0733-4f6f-9c57-d9d5ef979443",
4
+ "applicant_id": "fcb73186-0733-4f6f-9c57-d9d5ef979443",
5
+ "workflow_id": "fcb73186-0733-4f6f-9c57-d9d5ef979443",
6
+ "workflow_version_id": 11,
7
+ "status": "approved",
8
+ "dashboard_url":"https://dashboard.onfido.com/results/fcb73186-0733-4f6f-9c57-d9d5ef979443",
9
+ "output": {"prop1": "val_1", "prop2": 10},
10
+ "reasons": ["reason_1", "reason_2"],
11
+ "error": null,
12
+ "created_at": "2022-06-28T15:39:42Z",
13
+ "updated_at": "2022-07-28T15:40:42Z",
14
+ "link": {
15
+ "completed_redirect_url": "https://example.onfido.com",
16
+ "expired_redirect_url": "https://example.onfido.com",
17
+ "expires_at": "2022-10-17T14:40:50Z",
18
+ "language": "en_US",
19
+ "url": "https://eu.onfido.app/l/fcb73186-0733-4f6f-9c57-d9d5ef979443"
20
+ }
21
+ },
22
+ {
23
+ "id": "fcb73186-0733-4f6f-9c57-d9d5ef979463",
24
+ "applicant_id": "fcb73186-0733-4f6f-9c57-d9d5ef979443",
25
+ "workflow_id": "fcb73186-0733-4f6f-9c57-d9d5ef979443",
26
+ "workflow_version_id": 11,
27
+ "status": "approved",
28
+ "dashboard_url":"https://dashboard.onfido.com/results/fcb73186-0733-4f6f-9c57-d9d5ef979443",
29
+ "output": {"prop1": "val_1", "prop2": 10},
30
+ "reasons": ["reason_1", "reason_2"],
31
+ "error": null,
32
+ "created_at": "2022-06-28T15:39:42Z",
33
+ "updated_at": "2022-07-28T15:40:42Z",
34
+ "link": {
35
+ "completed_redirect_url": "https://example.onfido.com",
36
+ "expired_redirect_url": "https://example.onfido.com",
37
+ "expires_at": "2022-10-17T14:40:50Z",
38
+ "language": "en_US",
39
+ "url": "https://eu.onfido.app/l/fcb73186-0733-4f6f-9c57-d9d5ef979443"
40
+ }
41
+ }
42
+ ]
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.6.0
4
+ version: 2.7.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-12-02 00:00:00.000000000 Z
11
+ date: 2023-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -146,6 +146,7 @@ files:
146
146
  - lib/onfido/resources/report.rb
147
147
  - lib/onfido/resources/sdk_token.rb
148
148
  - lib/onfido/resources/webhook.rb
149
+ - lib/onfido/resources/workflow_run.rb
149
150
  - lib/onfido/version.rb
150
151
  - onfido.gemspec
151
152
  - spec/integrations/address_spec.rb
@@ -161,6 +162,7 @@ files:
161
162
  - spec/integrations/resource_spec.rb
162
163
  - spec/integrations/sdk_token_spec.rb
163
164
  - spec/integrations/webhook_spec.rb
165
+ - spec/integrations/workflow_run_spec.rb
164
166
  - spec/onfido/api_spec.rb
165
167
  - spec/onfido/connection_error_spec.rb
166
168
  - spec/onfido/options_spec.rb
@@ -191,6 +193,8 @@ files:
191
193
  - spec/support/fixtures/unexpected_error_format.json
192
194
  - spec/support/fixtures/webhook.json
193
195
  - spec/support/fixtures/webhooks.json
196
+ - spec/support/fixtures/workflow_run.json
197
+ - spec/support/fixtures/workflow_runs.json
194
198
  homepage: http://github.com/onfido/onfido-ruby
195
199
  licenses:
196
200
  - MIT
@@ -228,6 +232,7 @@ test_files:
228
232
  - spec/integrations/resource_spec.rb
229
233
  - spec/integrations/sdk_token_spec.rb
230
234
  - spec/integrations/webhook_spec.rb
235
+ - spec/integrations/workflow_run_spec.rb
231
236
  - spec/onfido/api_spec.rb
232
237
  - spec/onfido/connection_error_spec.rb
233
238
  - spec/onfido/options_spec.rb
@@ -258,3 +263,5 @@ test_files:
258
263
  - spec/support/fixtures/unexpected_error_format.json
259
264
  - spec/support/fixtures/webhook.json
260
265
  - spec/support/fixtures/webhooks.json
266
+ - spec/support/fixtures/workflow_run.json
267
+ - spec/support/fixtures/workflow_runs.json