onfido 4.5.0 → 4.6.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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +14 -12
- data/lib/onfido/api_client.rb +1 -1
- data/lib/onfido/models/id_number.rb +2 -2
- data/lib/onfido/models/webhook_event_payload_resource.rb +33 -4
- data/lib/onfido/version.rb +1 -1
- data/spec/integrations/report_spec.rb +4 -2
- data/spec/integrations/workflow_run_spec.rb +3 -1
- data/spec/spec_helper.rb +3 -3
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d96d6906170b9be6731106168f61d6da039f67f8f65e7202274ef3259e645172
|
4
|
+
data.tar.gz: daf83bf07548dcba4da864e17c03b768aaf86b4d68bce658c4b2164d30ad6407
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05a2d8051fbffeed8e82da41ab88a118477baf3e6214f62fc1c8a5327979dea2fa29a73e4cf0909acb833fa41cb0e5adf8a11cb46a44d297bf3a4b9d51f14276
|
7
|
+
data.tar.gz: fa62c445cae9183851eff0acaa5efff06a9a76abce6e216516ad872ed75cdd01ff125098b42b8697212b8e212d06de9fa8c4eecda7b6d90d145a14c02124010c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v4.5.0 8th January 2025
|
4
|
+
|
5
|
+
- Release based on Onfido OpenAPI spec version [v4.5.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v4.5.0):
|
6
|
+
- [STUDIO-4305] Add download evidence folder path
|
7
|
+
|
3
8
|
## v4.4.0 20th December 2024
|
4
9
|
|
5
10
|
- Release based on Onfido OpenAPI spec version [v4.4.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v4.4.0):
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
The official Ruby library for integrating with the Onfido API.
|
4
4
|
|
5
|
-
|
5
|
+
Refer to the documentation at <https://documentation.onfido.com>.
|
6
6
|
|
7
7
|
This version uses Onfido API v3.6. Refer to our [API versioning guide](https://developers.onfido.com/guide/api-versioning-policy#client-libraries) for details of which client library versions use which versions of the API.
|
8
8
|
|
@@ -14,7 +14,7 @@ This version uses Onfido API v3.6. Refer to our [API versioning guide](https://d
|
|
14
14
|
### Installation
|
15
15
|
|
16
16
|
```ruby
|
17
|
-
gem onfido, '~> 4.
|
17
|
+
gem onfido, '~> 4.6.0'
|
18
18
|
```
|
19
19
|
|
20
20
|
Configure with your API token, region and optional timeout (default value is 30):
|
@@ -42,7 +42,7 @@ applicant = onfido_api.create_applicant(
|
|
42
42
|
)
|
43
43
|
```
|
44
44
|
|
45
|
-
Documentation and code examples can be found at https://documentation.onfido.com
|
45
|
+
Documentation and code examples can be found at <https://documentation.onfido.com>.
|
46
46
|
|
47
47
|
## Error Handling
|
48
48
|
|
@@ -65,7 +65,7 @@ end
|
|
65
65
|
|
66
66
|
### Webhook event verification
|
67
67
|
|
68
|
-
Webhook events payload needs to be verified before it can be accessed.
|
68
|
+
Webhook events payload needs to be verified before it can be accessed. Verifying webhook payloads is crucial for security reasons, as it ensures that the payloads are indeed from Onfido and have not been tampered with. The library allows you to easily decode the payload and verify its signature before returning it as an object for user convenience:
|
69
69
|
|
70
70
|
```ruby
|
71
71
|
require 'onfido/webhook_event_verifier'
|
@@ -86,37 +86,39 @@ Webhook events payload needs to be verified before it can be accessed. Library a
|
|
86
86
|
|
87
87
|
## Contributing
|
88
88
|
|
89
|
-
This library is automatically generated using [OpenAPI Generator](https://openapi-generator.tech) (version: 7.9.0); therefore all
|
89
|
+
This library is automatically generated using [OpenAPI Generator](https://openapi-generator.tech) (version: 7.9.0); therefore, all contributions (except test files) should target the [Onfido OpenAPI specification repository](https://github.com/onfido/onfido-openapi-spec/tree/master) instead of this repository. Please follow the contribution guidelines provided in the OpenAPI specification repository.
|
90
90
|
|
91
91
|
For contributions to the tests instead, please follow the steps below:
|
92
92
|
|
93
|
-
1. [
|
93
|
+
1. Fork the [repository](https://github.com/onfido/onfido-ruby/fork)
|
94
94
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
95
95
|
3. Make your changes
|
96
|
-
4. Commit your changes (`git commit -am 'Add
|
96
|
+
4. Commit your changes (`git commit -am 'Add detailed description of the feature'`)
|
97
97
|
5. Push to the branch (`git push origin my-new-feature`)
|
98
98
|
6. Create a new Pull Request
|
99
99
|
|
100
100
|
## Versioning policy
|
101
101
|
|
102
|
-
|
102
|
+
Versioning helps manage changes and ensures compatibility across different versions of the library.
|
103
103
|
|
104
|
-
|
104
|
+
[Semantic Versioning](https://semver.org) policy is used for library versioning, following the guidelines and limitations outlined below:
|
105
|
+
|
106
|
+
- MAJOR versions (x.0.0) may:
|
105
107
|
- target a new API version
|
106
108
|
- include non-backward compatible change
|
107
|
-
- MINOR versions (0.x.0)
|
109
|
+
- MINOR versions (0.x.0) may:
|
108
110
|
- add a new functionality, non-mandatory parameter or property
|
109
111
|
- deprecate an old functionality
|
110
112
|
- include non-backward compatible change to a functionality which is:
|
111
113
|
- labelled as alpha or beta
|
112
114
|
- completely broken and not usable
|
113
|
-
- PATCH version (0.0.x)
|
115
|
+
- PATCH version (0.0.x) will:
|
114
116
|
- fix a bug
|
115
117
|
- include backward compatible changes only
|
116
118
|
|
117
119
|
## More documentation
|
118
120
|
|
119
|
-
|
121
|
+
Additional documentation and code examples can be found at <https://documentation.onfido.com>.
|
120
122
|
|
121
123
|
## Support
|
122
124
|
|
data/lib/onfido/api_client.rb
CHANGED
@@ -34,7 +34,7 @@ module Onfido
|
|
34
34
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
35
35
|
def initialize(config = Configuration.default)
|
36
36
|
@config = config
|
37
|
-
@user_agent = "onfido-ruby/4.
|
37
|
+
@user_agent = "onfido-ruby/4.6.0"
|
38
38
|
@default_headers = {
|
39
39
|
'Content-Type' => 'application/json',
|
40
40
|
'User-Agent' => @user_agent
|
@@ -115,7 +115,7 @@ module Onfido
|
|
115
115
|
# @return true if the model is valid
|
116
116
|
def valid?
|
117
117
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
118
|
-
type_validator = EnumAttributeValidator.new('String', ["ssn", "social_insurance", "tax_id", "identity_card", "driving_licence", "share_code", "voter_id", "passport", "other", "unknown_default_open_api"])
|
118
|
+
type_validator = EnumAttributeValidator.new('String', ["ssn", "social_insurance", "tax_id", "identity_card", "driving_license", "driving_licence", "share_code", "voter_id", "passport", "other", "unknown_default_open_api"])
|
119
119
|
return false unless type_validator.valid?(@type)
|
120
120
|
true
|
121
121
|
end
|
@@ -123,7 +123,7 @@ module Onfido
|
|
123
123
|
# Custom attribute writer method checking allowed values (enum).
|
124
124
|
# @param [Object] type Object to be assigned
|
125
125
|
def type=(type)
|
126
|
-
validator = EnumAttributeValidator.new('String', ["ssn", "social_insurance", "tax_id", "identity_card", "driving_licence", "share_code", "voter_id", "passport", "other", "unknown_default_open_api"])
|
126
|
+
validator = EnumAttributeValidator.new('String', ["ssn", "social_insurance", "tax_id", "identity_card", "driving_license", "driving_licence", "share_code", "voter_id", "passport", "other", "unknown_default_open_api"])
|
127
127
|
unless validator.valid?(type)
|
128
128
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
129
129
|
end
|
@@ -60,6 +60,9 @@ module Onfido
|
|
60
60
|
# Error object that details why a Workflow Run is in Error status.
|
61
61
|
attr_accessor :error
|
62
62
|
|
63
|
+
# Customer-provided user identifier.
|
64
|
+
attr_accessor :customer_user_id
|
65
|
+
|
63
66
|
# Attribute mapping from ruby-style variable name to JSON key.
|
64
67
|
def self.attribute_map
|
65
68
|
{
|
@@ -77,7 +80,8 @@ module Onfido
|
|
77
80
|
:'output' => :'output',
|
78
81
|
:'reasons' => :'reasons',
|
79
82
|
:'link' => :'link',
|
80
|
-
:'error' => :'error'
|
83
|
+
:'error' => :'error',
|
84
|
+
:'customer_user_id' => :'customer_user_id'
|
81
85
|
}
|
82
86
|
end
|
83
87
|
|
@@ -103,7 +107,8 @@ module Onfido
|
|
103
107
|
:'output' => :'Object',
|
104
108
|
:'reasons' => :'Array<String>',
|
105
109
|
:'link' => :'WorkflowRunLink',
|
106
|
-
:'error' => :'WorkflowRunError'
|
110
|
+
:'error' => :'WorkflowRunError',
|
111
|
+
:'customer_user_id' => :'String'
|
107
112
|
}
|
108
113
|
end
|
109
114
|
|
@@ -191,6 +196,10 @@ module Onfido
|
|
191
196
|
if attributes.key?(:'error')
|
192
197
|
self.error = attributes[:'error']
|
193
198
|
end
|
199
|
+
|
200
|
+
if attributes.key?(:'customer_user_id')
|
201
|
+
self.customer_user_id = attributes[:'customer_user_id']
|
202
|
+
end
|
194
203
|
end
|
195
204
|
|
196
205
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -203,6 +212,10 @@ module Onfido
|
|
203
212
|
invalid_properties.push("invalid value for \"task_def_id\", must conform to the pattern #{pattern}.")
|
204
213
|
end
|
205
214
|
|
215
|
+
if !@customer_user_id.nil? && @customer_user_id.to_s.length > 256
|
216
|
+
invalid_properties.push('invalid value for "customer_user_id", the character length must be smaller than or equal to 256.')
|
217
|
+
end
|
218
|
+
|
206
219
|
invalid_properties
|
207
220
|
end
|
208
221
|
|
@@ -211,6 +224,7 @@ module Onfido
|
|
211
224
|
def valid?
|
212
225
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
213
226
|
return false if !@task_def_id.nil? && @task_def_id !~ Regexp.new(/^[0-9a-z_-]+$/)
|
227
|
+
return false if !@customer_user_id.nil? && @customer_user_id.to_s.length > 256
|
214
228
|
true
|
215
229
|
end
|
216
230
|
|
@@ -229,6 +243,20 @@ module Onfido
|
|
229
243
|
@task_def_id = task_def_id
|
230
244
|
end
|
231
245
|
|
246
|
+
# Custom attribute writer method with validation
|
247
|
+
# @param [Object] customer_user_id Value to be assigned
|
248
|
+
def customer_user_id=(customer_user_id)
|
249
|
+
if customer_user_id.nil?
|
250
|
+
fail ArgumentError, 'customer_user_id cannot be nil'
|
251
|
+
end
|
252
|
+
|
253
|
+
if customer_user_id.to_s.length > 256
|
254
|
+
fail ArgumentError, 'invalid value for "customer_user_id", the character length must be smaller than or equal to 256.'
|
255
|
+
end
|
256
|
+
|
257
|
+
@customer_user_id = customer_user_id
|
258
|
+
end
|
259
|
+
|
232
260
|
# Checks equality by comparing each attribute.
|
233
261
|
# @param [Object] Object to be compared
|
234
262
|
def ==(o)
|
@@ -248,7 +276,8 @@ module Onfido
|
|
248
276
|
output == o.output &&
|
249
277
|
reasons == o.reasons &&
|
250
278
|
link == o.link &&
|
251
|
-
error == o.error
|
279
|
+
error == o.error &&
|
280
|
+
customer_user_id == o.customer_user_id
|
252
281
|
end
|
253
282
|
|
254
283
|
# @see the `==` method
|
@@ -260,7 +289,7 @@ module Onfido
|
|
260
289
|
# Calculates hash code according to all attributes.
|
261
290
|
# @return [Integer] Hash code
|
262
291
|
def hash
|
263
|
-
[id, applicant_id, created_at, updated_at, dashboard_url, workflow_id, workflow_run_id, workflow_version_id, task_def_id, task_def_version, input, output, reasons, link, error].hash
|
292
|
+
[id, applicant_id, created_at, updated_at, dashboard_url, workflow_id, workflow_run_id, workflow_version_id, task_def_id, task_def_version, input, output, reasons, link, error, customer_user_id].hash
|
264
293
|
end
|
265
294
|
|
266
295
|
# Builds the object from hash
|
data/lib/onfido/version.rb
CHANGED
@@ -23,13 +23,15 @@ describe Onfido::Report do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'finds a report' do
|
26
|
-
get_document_report =
|
26
|
+
get_document_report = repeat_request_until_status_changes(Onfido::ReportStatus::COMPLETE) {
|
27
|
+
onfido_api.find_report(document_report_id)
|
28
|
+
}
|
27
29
|
get_identity_report = onfido_api.find_report(identity_report_id)
|
28
30
|
|
29
31
|
expect(get_document_report).to be_an_instance_of Onfido::DocumentReport
|
30
32
|
expect(get_document_report.id).to eq document_report_id
|
31
33
|
expect(get_document_report.name).to eq Onfido::ReportName::DOCUMENT
|
32
|
-
expect(get_document_report.status).to eq Onfido::ReportStatus::
|
34
|
+
expect(get_document_report.status).to eq Onfido::ReportStatus::COMPLETE
|
33
35
|
|
34
36
|
expect(get_identity_report).to be_an_instance_of Onfido::IdentityEnhancedReport
|
35
37
|
expect(get_identity_report.id).to eq identity_report_id
|
@@ -82,7 +82,9 @@ describe Onfido::WorkflowRun do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
it 'downloads an evidence folder' do
|
85
|
-
file =
|
85
|
+
file = repeat_request_unti_http_code_changes do
|
86
|
+
onfido_api.download_evidence_folder(workflow_run_id)
|
87
|
+
end
|
86
88
|
|
87
89
|
Zip::File.open(file.path) do |zip|
|
88
90
|
expect(zip.entries.size).to be > 0
|
data/spec/spec_helper.rb
CHANGED
@@ -65,7 +65,7 @@ RSpec.configure do |config|
|
|
65
65
|
Kernel.srand config.seed
|
66
66
|
end
|
67
67
|
|
68
|
-
def repeat_request_until_status_changes(expected_status, max_retries =
|
68
|
+
def repeat_request_until_status_changes(expected_status, max_retries = 15,
|
69
69
|
interval = 1, &proc)
|
70
70
|
# expected_status --> desired status
|
71
71
|
# max_retries --> how many times to retry the request
|
@@ -86,7 +86,7 @@ def repeat_request_until_status_changes(expected_status, max_retries = 10,
|
|
86
86
|
instance
|
87
87
|
end
|
88
88
|
|
89
|
-
def repeat_request_until_task_output_changes(max_retries =
|
89
|
+
def repeat_request_until_task_output_changes(max_retries = 15,
|
90
90
|
interval = 1, &proc)
|
91
91
|
# max_retries --> how many times to retry the request
|
92
92
|
# interval --> how many seconds to wait until the next retry
|
@@ -106,7 +106,7 @@ def repeat_request_until_task_output_changes(max_retries = 10,
|
|
106
106
|
instance
|
107
107
|
end
|
108
108
|
|
109
|
-
def repeat_request_unti_http_code_changes(max_retries =
|
109
|
+
def repeat_request_unti_http_code_changes(max_retries = 15,
|
110
110
|
interval = 1, &proc)
|
111
111
|
# max_retries --> how many times to retry the request
|
112
112
|
# interval --> how many seconds to wait until the next retry
|
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: 4.
|
4
|
+
version: 4.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenAPI-Generator
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -487,33 +487,33 @@ specification_version: 4
|
|
487
487
|
summary: The official Ruby library for integrating with the Onfido API.
|
488
488
|
test_files:
|
489
489
|
- spec/classic_webhook_event_verifier_spec.rb
|
490
|
-
- spec/integrations/report_schema_spec.rb
|
491
|
-
- spec/integrations/sdk_token_spec.rb
|
492
|
-
- spec/integrations/applicant_spec.rb
|
493
|
-
- spec/integrations/workflow_run_spec.rb
|
494
|
-
- spec/integrations/workflow_run_output_spec.rb
|
495
|
-
- spec/integrations/webhook_spec.rb
|
496
|
-
- spec/integrations/watchlist_monitor_spec.rb
|
497
490
|
- spec/integrations/live_video_spec.rb
|
498
491
|
- spec/integrations/document_spec.rb
|
499
492
|
- spec/integrations/live_photo_spec.rb
|
493
|
+
- spec/integrations/report_schema_spec.rb
|
500
494
|
- spec/integrations/qualified_electronic_signature_spec.rb
|
501
495
|
- spec/integrations/motion_capture_spec.rb
|
502
|
-
- spec/integrations/address_picker_spec.rb
|
503
496
|
- spec/integrations/tasks_spec.rb
|
497
|
+
- spec/integrations/workflow_run_spec.rb
|
498
|
+
- spec/integrations/webhook_spec.rb
|
499
|
+
- spec/integrations/report_spec.rb
|
500
|
+
- spec/integrations/address_picker_spec.rb
|
501
|
+
- spec/integrations/check_spec.rb
|
502
|
+
- spec/integrations/sdk_token_spec.rb
|
503
|
+
- spec/integrations/extraction_spec.rb
|
504
|
+
- spec/integrations/workflow_run_output_spec.rb
|
505
|
+
- spec/integrations/applicant_spec.rb
|
504
506
|
- spec/integrations/media/sample_photo.png
|
505
507
|
- spec/integrations/media/sample_driving_licence.png
|
506
|
-
- spec/integrations/check_spec.rb
|
507
508
|
- spec/integrations/id_photo_spec.rb
|
508
|
-
- spec/integrations/
|
509
|
-
- spec/integrations/report_spec.rb
|
510
|
-
- spec/media/studio_webhook_event_with_object_in_output.json
|
509
|
+
- spec/integrations/watchlist_monitor_spec.rb
|
511
510
|
- spec/media/studio_webhook_event_with_list_in_output.json
|
512
|
-
- spec/
|
513
|
-
- spec/shared_contexts/with_check.rb
|
511
|
+
- spec/media/studio_webhook_event_with_object_in_output.json
|
514
512
|
- spec/shared_contexts/with_workflow_run.rb
|
515
513
|
- spec/shared_contexts/with_applicant.rb
|
516
514
|
- spec/shared_contexts/with_live_photo.rb
|
515
|
+
- spec/shared_contexts/with_document.rb
|
516
|
+
- spec/shared_contexts/with_check.rb
|
517
517
|
- spec/shared_contexts/with_onfido.rb
|
518
518
|
- spec/spec_helper.rb
|
519
519
|
- spec/studio_webhook_event_verifier_spec.rb
|