onfido 3.1.0 → 3.2.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: e49647b89683e1a972dd4aa7fc52fe3b83a2ef5b91015b703f2f1825163aefdf
4
- data.tar.gz: c2c0fc5cfef81086c92b90765ab0156b4d401bde312566350edfe8dd52d90a87
3
+ metadata.gz: f7d0e5a36b63c80054591811ae2e6ebe0a221b58352b53130da2e2cb53cf2bee
4
+ data.tar.gz: 5cd5f1afa7bb2d2dd82f0db84e407cad430bbe66cc8af3318fb54e9c9d0b10fc
5
5
  SHA512:
6
- metadata.gz: 7ad579443fe7bb71ea26ebf39c622959f386bbae04a6450fb5d6617026e68a691c67a6ddb9928f97a4610161c246ac596a8ca8b226df907836a1ab6293e058b5
7
- data.tar.gz: 667e52f85d7afb8d775c66db9ccfb6f121feb80510628784863ce576321f66cc19014f850397696598ad116d04171db1f465baf218cb99801a3ddf9cdfcff329
6
+ metadata.gz: a372a4c0ad74bacd1a065b8b294e35002fd7fa9a5e8f27239ce50d4909c6ce5c481c778a5e7420e087ec1eb3afe673e19ef206ee771c5f5b2c62a7a75e0dbf8f
7
+ data.tar.gz: 86303e99596c6b75a194913bdacd6a192d4e00d8eee69e5e18f3105a7e87e262fece2060371237dfeb78c8010107f9a98ccc1d30839ee2f14ace835af0d71e50
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## v3.1.0 5th July 2024
4
+
5
+ - Release based on Onfido OpenAPI spec version [v3.1.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v3.1.0):
6
+ - Add missing fields in document report's properties
7
+
3
8
  ## v3.0.0 24th June 2024
4
9
 
5
10
  - Library has been rebuilt from scratch and automatically generated on [Onfido OpenAPI Spec](https://github.com/onfido/onfido-openapi-spec) (release [v3.0.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v3.0.0))
data/README.md CHANGED
@@ -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, '~> 3.1.0'
17
+ gem onfido, '~> 3.2.0'
18
18
  ```
19
19
 
20
20
  Configure with your API token, region and optional timeout (default value is 30):
@@ -46,20 +46,20 @@ Documentation and code examples can be found at https://documentation.onfido.com
46
46
 
47
47
  ## Error Handling
48
48
 
49
- All errors are wrapped by `ApiError` coming from [FaradayExpection](https://www.rubydoc.info/github/lostisland/faraday/Faraday/ClientError):
49
+ All errors are wrapped by `ApiError` coming from [FaradayException](https://www.rubydoc.info/github/lostisland/faraday/Faraday/ClientError):
50
50
 
51
51
  - `Connection timed out` is raised in case of `Faraday::TimeoutError`
52
52
  - `Connection failed` is raised in case of `Faraday::ConnectionFailed`
53
53
 
54
- All errors provide the `response_code`, `response_body`, `json_body`, `type` and `fields` of the error.
54
+ All errors provide the `code`, `response_headers`, and `response_body` of the error.
55
55
 
56
56
  ```ruby
57
57
  def create_applicant
58
58
  onfido_api.create_applicant(params)
59
- rescue Faraday::ConnectionFailed => e
60
- e.type # => 'validation_error'
61
- e.fields # => { "email": { "messages": ["invalid format"] } }
62
- e.response_code # => '422'
59
+ rescue Onfido::ApiError => e
60
+ e.message # => 'Unprocessable entity'
61
+ e.response_body # => { error: { type: "validation_error", message: "", fields: { "email": [ "invalid format" ] } } }
62
+ e.code # => '422'
63
63
  end
64
64
  ```
65
65
 
@@ -1321,6 +1321,77 @@ module Onfido
1321
1321
  return data, status_code, headers
1322
1322
  end
1323
1323
 
1324
+ # Retrieves the signed document or application form
1325
+ # Retrieves the signed document or application form depending on the file_id provided.
1326
+ # @param workflow_run_id [String] The unique identifier of the Workflow Run for which you want to retrieve the signed document.
1327
+ # @param file_id [String] The unique identifier of the file which you want to retrieve.
1328
+ # @param [Hash] opts the optional parameters
1329
+ # @return [File]
1330
+ def download_qes_document(workflow_run_id, file_id, opts = {})
1331
+ data, _status_code, _headers = download_qes_document_with_http_info(workflow_run_id, file_id, opts)
1332
+ data
1333
+ end
1334
+
1335
+ # Retrieves the signed document or application form
1336
+ # Retrieves the signed document or application form depending on the file_id provided.
1337
+ # @param workflow_run_id [String] The unique identifier of the Workflow Run for which you want to retrieve the signed document.
1338
+ # @param file_id [String] The unique identifier of the file which you want to retrieve.
1339
+ # @param [Hash] opts the optional parameters
1340
+ # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
1341
+ def download_qes_document_with_http_info(workflow_run_id, file_id, opts = {})
1342
+ if @api_client.config.debugging
1343
+ @api_client.config.logger.debug 'Calling API: DefaultApi.download_qes_document ...'
1344
+ end
1345
+ # verify the required parameter 'workflow_run_id' is set
1346
+ if @api_client.config.client_side_validation && workflow_run_id.nil?
1347
+ fail ArgumentError, "Missing the required parameter 'workflow_run_id' when calling DefaultApi.download_qes_document"
1348
+ end
1349
+ # verify the required parameter 'file_id' is set
1350
+ if @api_client.config.client_side_validation && file_id.nil?
1351
+ fail ArgumentError, "Missing the required parameter 'file_id' when calling DefaultApi.download_qes_document"
1352
+ end
1353
+ # resource path
1354
+ local_var_path = '/qualified_electronic_signature/documents'
1355
+
1356
+ # query parameters
1357
+ query_params = opts[:query_params] || {}
1358
+ query_params[:'workflow_run_id'] = workflow_run_id
1359
+ query_params[:'file_id'] = file_id
1360
+
1361
+ # header parameters
1362
+ header_params = opts[:header_params] || {}
1363
+ # HTTP header 'Accept' (if needed)
1364
+ header_params['Accept'] = @api_client.select_header_accept(['application/pdf', 'application/json'])
1365
+
1366
+ # form parameters
1367
+ form_params = opts[:form_params] || {}
1368
+
1369
+ # http body (model)
1370
+ post_body = opts[:debug_body]
1371
+
1372
+ # return_type
1373
+ return_type = opts[:debug_return_type] || 'File'
1374
+
1375
+ # auth_names
1376
+ auth_names = opts[:debug_auth_names] || ['Token']
1377
+
1378
+ new_options = opts.merge(
1379
+ :operation => :"DefaultApi.download_qes_document",
1380
+ :header_params => header_params,
1381
+ :query_params => query_params,
1382
+ :form_params => form_params,
1383
+ :body => post_body,
1384
+ :auth_names => auth_names,
1385
+ :return_type => return_type
1386
+ )
1387
+
1388
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1389
+ if @api_client.config.debugging
1390
+ @api_client.config.logger.debug "API called: DefaultApi#download_qes_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1391
+ end
1392
+ return data, status_code, headers
1393
+ end
1394
+
1324
1395
  # Retrieve Workflow Run Evidence Summary File
1325
1396
  # Retrieves the signed evidence file for the designated Workflow Run
1326
1397
  # @param workflow_run_id [String] Workflow Run ID
@@ -4030,7 +4101,7 @@ module Onfido
4030
4101
  if @api_client.config.client_side_validation && file.nil?
4031
4102
  fail ArgumentError, "Missing the required parameter 'file' when calling DefaultApi.upload_document"
4032
4103
  end
4033
- allowable_values = ["jpg", "png", "pdf", "unknown_default_open_api"]
4104
+ allowable_values = ["jpg", "jpeg", "png", "pdf", "unknown_default_open_api"]
4034
4105
  if @api_client.config.client_side_validation && opts[:'file_type'] && !allowable_values.include?(opts[:'file_type'])
4035
4106
  fail ArgumentError, "invalid value for \"file_type\", must be one of #{allowable_values}"
4036
4107
  end
@@ -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/3.1.0"
37
+ @user_agent = "onfido-ruby/3.2.0"
38
38
  @default_headers = {
39
39
  'Content-Type' => 'application/json',
40
40
  'User-Agent' => @user_agent
@@ -201,7 +201,7 @@ module Onfido
201
201
  # @return true if the model is valid
202
202
  def valid?
203
203
  warn '[DEPRECATED] the `valid?` method is obsolete'
204
- file_type_validator = EnumAttributeValidator.new('String', ["jpg", "png", "pdf", "unknown_default_open_api"])
204
+ file_type_validator = EnumAttributeValidator.new('String', ["jpg", "jpeg", "png", "pdf", "unknown_default_open_api"])
205
205
  return false unless file_type_validator.valid?(@file_type)
206
206
  side_validator = EnumAttributeValidator.new('String', ["front", "back", "unknown_default_open_api"])
207
207
  return false unless side_validator.valid?(@side)
@@ -212,7 +212,7 @@ module Onfido
212
212
  # Custom attribute writer method checking allowed values (enum).
213
213
  # @param [Object] file_type Object to be assigned
214
214
  def file_type=(file_type)
215
- validator = EnumAttributeValidator.new('String', ["jpg", "png", "pdf", "unknown_default_open_api"])
215
+ validator = EnumAttributeValidator.new('String', ["jpg", "jpeg", "png", "pdf", "unknown_default_open_api"])
216
216
  unless validator.valid?(file_type)
217
217
  fail ArgumentError, "invalid value for \"file_type\", must be one of #{validator.allowable_values}."
218
218
  end
@@ -27,12 +27,14 @@ module Onfido
27
27
 
28
28
  attr_accessor :first_name
29
29
 
30
+ attr_accessor :middle_name
31
+
32
+ attr_accessor :last_name
33
+
30
34
  attr_accessor :gender
31
35
 
32
36
  attr_accessor :issuing_country
33
37
 
34
- attr_accessor :last_name
35
-
36
38
  attr_accessor :nationality
37
39
 
38
40
  attr_accessor :issuing_state
@@ -134,9 +136,10 @@ module Onfido
134
136
  :'document_numbers' => :'document_numbers',
135
137
  :'document_type' => :'document_type',
136
138
  :'first_name' => :'first_name',
139
+ :'middle_name' => :'middle_name',
140
+ :'last_name' => :'last_name',
137
141
  :'gender' => :'gender',
138
142
  :'issuing_country' => :'issuing_country',
139
- :'last_name' => :'last_name',
140
143
  :'nationality' => :'nationality',
141
144
  :'issuing_state' => :'issuing_state',
142
145
  :'issuing_date' => :'issuing_date',
@@ -189,9 +192,10 @@ module Onfido
189
192
  :'document_numbers' => :'Array<DocumentPropertiesDocumentNumbersInner>',
190
193
  :'document_type' => :'String',
191
194
  :'first_name' => :'String',
195
+ :'middle_name' => :'String',
196
+ :'last_name' => :'String',
192
197
  :'gender' => :'String',
193
198
  :'issuing_country' => :'String',
194
- :'last_name' => :'String',
195
199
  :'nationality' => :'String',
196
200
  :'issuing_state' => :'String',
197
201
  :'issuing_date' => :'Date',
@@ -277,6 +281,14 @@ module Onfido
277
281
  self.first_name = attributes[:'first_name']
278
282
  end
279
283
 
284
+ if attributes.key?(:'middle_name')
285
+ self.middle_name = attributes[:'middle_name']
286
+ end
287
+
288
+ if attributes.key?(:'last_name')
289
+ self.last_name = attributes[:'last_name']
290
+ end
291
+
280
292
  if attributes.key?(:'gender')
281
293
  self.gender = attributes[:'gender']
282
294
  end
@@ -285,10 +297,6 @@ module Onfido
285
297
  self.issuing_country = attributes[:'issuing_country']
286
298
  end
287
299
 
288
- if attributes.key?(:'last_name')
289
- self.last_name = attributes[:'last_name']
290
- end
291
-
292
300
  if attributes.key?(:'nationality')
293
301
  self.nationality = attributes[:'nationality']
294
302
  end
@@ -494,9 +502,10 @@ module Onfido
494
502
  document_numbers == o.document_numbers &&
495
503
  document_type == o.document_type &&
496
504
  first_name == o.first_name &&
505
+ middle_name == o.middle_name &&
506
+ last_name == o.last_name &&
497
507
  gender == o.gender &&
498
508
  issuing_country == o.issuing_country &&
499
- last_name == o.last_name &&
500
509
  nationality == o.nationality &&
501
510
  issuing_state == o.issuing_state &&
502
511
  issuing_date == o.issuing_date &&
@@ -543,7 +552,7 @@ module Onfido
543
552
  # Calculates hash code according to all attributes.
544
553
  # @return [Integer] Hash code
545
554
  def hash
546
- [date_of_birth, date_of_expiry, personal_number, document_numbers, document_type, first_name, gender, issuing_country, last_name, nationality, issuing_state, issuing_date, categorisation, mrz_line1, mrz_line2, mrz_line3, address, place_of_birth, spouse_name, widow_name, alias_name, issuing_authority, remarks, civil_state, expatriation, father_name, mother_name, religion, type_of_permit, version_number, document_subtype, profession, security_document_number, tax_number, nist_identity_evidence_strength, has_issuance_confirmation, real_id_compliance, security_tier, address_lines, barcode, nfc, driving_licence_information, document_classification, extracted_data].hash
555
+ [date_of_birth, date_of_expiry, personal_number, document_numbers, document_type, first_name, middle_name, last_name, gender, issuing_country, nationality, issuing_state, issuing_date, categorisation, mrz_line1, mrz_line2, mrz_line3, address, place_of_birth, spouse_name, widow_name, alias_name, issuing_authority, remarks, civil_state, expatriation, father_name, mother_name, religion, type_of_permit, version_number, document_subtype, profession, security_document_number, tax_number, nist_identity_evidence_strength, has_issuance_confirmation, real_id_compliance, security_tier, address_lines, barcode, nfc, driving_licence_information, document_classification, extracted_data].hash
547
556
  end
548
557
 
549
558
  # Builds the object from hash
@@ -133,7 +133,7 @@ module Onfido
133
133
  # @return true if the model is valid
134
134
  def valid?
135
135
  warn '[DEPRECATED] the `valid?` method is obsolete'
136
- file_type_validator = EnumAttributeValidator.new('String', ["jpg", "png", "pdf", "unknown_default_open_api"])
136
+ file_type_validator = EnumAttributeValidator.new('String', ["jpg", "jpeg", "png", "pdf", "unknown_default_open_api"])
137
137
  return false unless file_type_validator.valid?(@file_type)
138
138
  side_validator = EnumAttributeValidator.new('String', ["front", "back", "unknown_default_open_api"])
139
139
  return false unless side_validator.valid?(@side)
@@ -143,7 +143,7 @@ module Onfido
143
143
  # Custom attribute writer method checking allowed values (enum).
144
144
  # @param [Object] file_type Object to be assigned
145
145
  def file_type=(file_type)
146
- validator = EnumAttributeValidator.new('String', ["jpg", "png", "pdf", "unknown_default_open_api"])
146
+ validator = EnumAttributeValidator.new('String', ["jpg", "jpeg", "png", "pdf", "unknown_default_open_api"])
147
147
  unless validator.valid?(file_type)
148
148
  fail ArgumentError, "invalid value for \"file_type\", must be one of #{validator.allowable_values}."
149
149
  end
@@ -27,12 +27,14 @@ module Onfido
27
27
 
28
28
  attr_accessor :first_name
29
29
 
30
+ attr_accessor :middle_name
31
+
32
+ attr_accessor :last_name
33
+
30
34
  attr_accessor :gender
31
35
 
32
36
  attr_accessor :issuing_country
33
37
 
34
- attr_accessor :last_name
35
-
36
38
  attr_accessor :nationality
37
39
 
38
40
  attr_accessor :issuing_state
@@ -151,9 +153,10 @@ module Onfido
151
153
  :'document_numbers' => :'document_numbers',
152
154
  :'document_type' => :'document_type',
153
155
  :'first_name' => :'first_name',
156
+ :'middle_name' => :'middle_name',
157
+ :'last_name' => :'last_name',
154
158
  :'gender' => :'gender',
155
159
  :'issuing_country' => :'issuing_country',
156
- :'last_name' => :'last_name',
157
160
  :'nationality' => :'nationality',
158
161
  :'issuing_state' => :'issuing_state',
159
162
  :'issuing_date' => :'issuing_date',
@@ -212,9 +215,10 @@ module Onfido
212
215
  :'document_numbers' => :'Array<DocumentPropertiesDocumentNumbersInner>',
213
216
  :'document_type' => :'String',
214
217
  :'first_name' => :'String',
218
+ :'middle_name' => :'String',
219
+ :'last_name' => :'String',
215
220
  :'gender' => :'String',
216
221
  :'issuing_country' => :'String',
217
- :'last_name' => :'String',
218
222
  :'nationality' => :'String',
219
223
  :'issuing_state' => :'String',
220
224
  :'issuing_date' => :'Date',
@@ -313,6 +317,14 @@ module Onfido
313
317
  self.first_name = attributes[:'first_name']
314
318
  end
315
319
 
320
+ if attributes.key?(:'middle_name')
321
+ self.middle_name = attributes[:'middle_name']
322
+ end
323
+
324
+ if attributes.key?(:'last_name')
325
+ self.last_name = attributes[:'last_name']
326
+ end
327
+
316
328
  if attributes.key?(:'gender')
317
329
  self.gender = attributes[:'gender']
318
330
  end
@@ -321,10 +333,6 @@ module Onfido
321
333
  self.issuing_country = attributes[:'issuing_country']
322
334
  end
323
335
 
324
- if attributes.key?(:'last_name')
325
- self.last_name = attributes[:'last_name']
326
- end
327
-
328
336
  if attributes.key?(:'nationality')
329
337
  self.nationality = attributes[:'nationality']
330
338
  end
@@ -556,9 +564,10 @@ module Onfido
556
564
  document_numbers == o.document_numbers &&
557
565
  document_type == o.document_type &&
558
566
  first_name == o.first_name &&
567
+ middle_name == o.middle_name &&
568
+ last_name == o.last_name &&
559
569
  gender == o.gender &&
560
570
  issuing_country == o.issuing_country &&
561
- last_name == o.last_name &&
562
571
  nationality == o.nationality &&
563
572
  issuing_state == o.issuing_state &&
564
573
  issuing_date == o.issuing_date &&
@@ -611,7 +620,7 @@ module Onfido
611
620
  # Calculates hash code according to all attributes.
612
621
  # @return [Integer] Hash code
613
622
  def hash
614
- [date_of_birth, date_of_expiry, personal_number, document_numbers, document_type, first_name, gender, issuing_country, last_name, nationality, issuing_state, issuing_date, categorisation, mrz_line1, mrz_line2, mrz_line3, address, place_of_birth, spouse_name, widow_name, alias_name, issuing_authority, remarks, civil_state, expatriation, father_name, mother_name, religion, type_of_permit, version_number, document_subtype, profession, security_document_number, tax_number, nist_identity_evidence_strength, has_issuance_confirmation, real_id_compliance, security_tier, address_lines, barcode, nfc, driving_licence_information, document_classification, extracted_data, drivers_licence, restricted_licence, raw_licence_category, raw_vehicle_classes, vehicle_class_details, passenger_vehicle].hash
623
+ [date_of_birth, date_of_expiry, personal_number, document_numbers, document_type, first_name, middle_name, last_name, gender, issuing_country, nationality, issuing_state, issuing_date, categorisation, mrz_line1, mrz_line2, mrz_line3, address, place_of_birth, spouse_name, widow_name, alias_name, issuing_authority, remarks, civil_state, expatriation, father_name, mother_name, religion, type_of_permit, version_number, document_subtype, profession, security_document_number, tax_number, nist_identity_evidence_strength, has_issuance_confirmation, real_id_compliance, security_tier, address_lines, barcode, nfc, driving_licence_information, document_classification, extracted_data, drivers_licence, restricted_licence, raw_licence_category, raw_vehicle_classes, vehicle_class_details, passenger_vehicle].hash
615
624
  end
616
625
 
617
626
  # Builds the object from hash
@@ -22,6 +22,9 @@ module Onfido
22
22
  # The current state of the object, if available.
23
23
  attr_accessor :status
24
24
 
25
+ # The date and time when the operation was started, if available.
26
+ attr_accessor :started_at_iso8601
27
+
25
28
  # The date and time when the operation was completed, if available.
26
29
  attr_accessor :completed_at_iso8601
27
30
 
@@ -33,6 +36,7 @@ module Onfido
33
36
  {
34
37
  :'id' => :'id',
35
38
  :'status' => :'status',
39
+ :'started_at_iso8601' => :'started_at_iso8601',
36
40
  :'completed_at_iso8601' => :'completed_at_iso8601',
37
41
  :'href' => :'href'
38
42
  }
@@ -48,6 +52,7 @@ module Onfido
48
52
  {
49
53
  :'id' => :'String',
50
54
  :'status' => :'String',
55
+ :'started_at_iso8601' => :'Time',
51
56
  :'completed_at_iso8601' => :'Time',
52
57
  :'href' => :'String'
53
58
  }
@@ -84,6 +89,10 @@ module Onfido
84
89
  self.status = attributes[:'status']
85
90
  end
86
91
 
92
+ if attributes.key?(:'started_at_iso8601')
93
+ self.started_at_iso8601 = attributes[:'started_at_iso8601']
94
+ end
95
+
87
96
  if attributes.key?(:'completed_at_iso8601')
88
97
  self.completed_at_iso8601 = attributes[:'completed_at_iso8601']
89
98
  end
@@ -127,6 +136,7 @@ module Onfido
127
136
  self.class == o.class &&
128
137
  id == o.id &&
129
138
  status == o.status &&
139
+ started_at_iso8601 == o.started_at_iso8601 &&
130
140
  completed_at_iso8601 == o.completed_at_iso8601 &&
131
141
  href == o.href
132
142
  end
@@ -140,7 +150,7 @@ module Onfido
140
150
  # Calculates hash code according to all attributes.
141
151
  # @return [Integer] Hash code
142
152
  def hash
143
- [id, status, completed_at_iso8601, href].hash
153
+ [id, status, started_at_iso8601, completed_at_iso8601, href].hash
144
154
  end
145
155
 
146
156
  # Builds the object from hash
@@ -11,5 +11,5 @@ Generator version: 7.6.0
11
11
  =end
12
12
 
13
13
  module Onfido
14
- VERSION = '3.1.0'
14
+ VERSION = '3.2.0'
15
15
  end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../shared_contexts/with_workflow_run'
4
+
5
+ describe Onfido::WorkflowRun do
6
+ include_context 'with applicant'
7
+
8
+ let(:workflow_id) { '8b74614f-9e7f-42fd-852a-5f2bcc852587' }
9
+
10
+ let(:workflow_run_builder) do
11
+ Onfido::WorkflowRunBuilder.new({
12
+ applicant_id: applicant_id,
13
+ workflow_id: workflow_id,
14
+ custom_data: {
15
+ country_of_operation: "GBR",
16
+ document_date_of_expiry: "2022-01-01",
17
+ document_issuing_country: "FRA",
18
+ document_issuing_date: "2022-01-01",
19
+ document_number: "Example string",
20
+ document_to_sign_url: "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
21
+ document_type: "driving_licence",
22
+ }
23
+ })
24
+ end
25
+
26
+ let(:workflow_run) { onfido_api.create_workflow_run(workflow_run_builder) }
27
+ let!(:workflow_run_id) { workflow_run.id }
28
+
29
+ let(:file_id) do
30
+ task = onfido_api.list_tasks(workflow_run_id)[0]
31
+
32
+ output = repeat_request_until_task_output_changes(
33
+ max_retries = 10,
34
+ interval = 3
35
+ ) { onfido_api.find_task(workflow_run_id, task.id) }.output
36
+
37
+ output[:properties][:signed_documents][0][:id]
38
+ end
39
+
40
+ describe 'Workflow run' do
41
+ it 'downloads qes document' do
42
+ file = onfido_api.download_qes_document(workflow_run_id, file_id)
43
+
44
+ expect(file.size).to be > 0
45
+ end
46
+ end
47
+ end
@@ -14,7 +14,7 @@ describe Onfido::Webhook do
14
14
  end
15
15
 
16
16
  let(:webhook) { onfido_api.create_webhook(webhook_builder) }
17
- let(:webhook_id) { webhook.id }
17
+ let!(:webhook_id) { webhook.id }
18
18
 
19
19
  it 'creates a webhook' do
20
20
  expect(webhook).to be_an_instance_of Onfido::Webhook
@@ -15,6 +15,8 @@ RSpec.shared_context 'with applicant', shared_context: :metadata do
15
15
  {
16
16
  'first_name' => 'Test',
17
17
  'last_name' => 'Applicant',
18
+ 'email' => "first.last@gmail.com",
19
+ 'phone_number' => "351911111111",
18
20
  'location' => {
19
21
  'ip_address' => '127.0.0.1',
20
22
  'country_of_residence' => 'GBR'
data/spec/spec_helper.rb CHANGED
@@ -86,6 +86,26 @@ 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 = 10,
90
+ interval = 1, &proc)
91
+ # max_retries --> how many times to retry the request
92
+ # interval --> how many seconds to wait until the next retry
93
+ # proc --> code containing the request
94
+
95
+ instance = proc.call
96
+
97
+ iteration = 0
98
+ while instance.output == nil
99
+ raise "task output did not change in time" if iteration > max_retries
100
+
101
+ iteration += 1
102
+ sleep(interval)
103
+ instance = proc.call
104
+ end
105
+
106
+ instance
107
+ end
108
+
89
109
  def repeat_request_unti_http_code_changes(max_retries = 10,
90
110
  interval = 1, &proc)
91
111
  # max_retries --> how many times to retry the request
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: 3.1.0
4
+ version: 3.2.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: 2024-07-05 00:00:00.000000000 Z
11
+ date: 2024-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -412,6 +412,7 @@ files:
412
412
  - spec/integrations/media/sample_driving_licence.png
413
413
  - spec/integrations/media/sample_photo.png
414
414
  - spec/integrations/motion_capture_spec.rb
415
+ - spec/integrations/qualified_electronic_signature_spec.rb
415
416
  - spec/integrations/report_schema_spec.rb
416
417
  - spec/integrations/report_spec.rb
417
418
  - spec/integrations/sdk_token_spec.rb
@@ -452,30 +453,31 @@ signing_key:
452
453
  specification_version: 4
453
454
  summary: The official Ruby library for integrating with the Onfido API.
454
455
  test_files:
455
- - spec/integrations/address_picker_spec.rb
456
- - spec/integrations/report_schema_spec.rb
457
- - spec/integrations/document_spec.rb
458
- - spec/integrations/extraction_spec.rb
459
- - spec/integrations/report_spec.rb
460
- - spec/integrations/motion_capture_spec.rb
461
- - spec/integrations/tasks_spec.rb
462
- - spec/integrations/webhook_spec.rb
463
- - spec/integrations/media/sample_photo.png
456
+ - spec/integrations/id_photo_spec.rb
457
+ - spec/integrations/workflow_run_spec.rb
464
458
  - spec/integrations/media/sample_driving_licence.png
459
+ - spec/integrations/media/sample_photo.png
460
+ - spec/integrations/webhook_spec.rb
461
+ - spec/integrations/report_spec.rb
462
+ - spec/integrations/workflow_run_output_spec.rb
465
463
  - spec/integrations/check_spec.rb
466
- - spec/integrations/live_video_spec.rb
467
- - spec/integrations/sdk_token_spec.rb
468
- - spec/integrations/live_photo_spec.rb
464
+ - spec/integrations/tasks_spec.rb
465
+ - spec/integrations/extraction_spec.rb
469
466
  - spec/integrations/watchlist_monitor_spec.rb
470
- - spec/integrations/id_photo_spec.rb
471
- - spec/integrations/workflow_run_output_spec.rb
472
- - spec/integrations/workflow_run_spec.rb
467
+ - spec/integrations/address_picker_spec.rb
473
468
  - spec/integrations/applicant_spec.rb
474
- - spec/shared_contexts/with_onfido.rb
475
- - spec/shared_contexts/with_applicant.rb
469
+ - spec/integrations/motion_capture_spec.rb
470
+ - spec/integrations/live_photo_spec.rb
471
+ - spec/integrations/report_schema_spec.rb
472
+ - spec/integrations/qualified_electronic_signature_spec.rb
473
+ - spec/integrations/sdk_token_spec.rb
474
+ - spec/integrations/document_spec.rb
475
+ - spec/integrations/live_video_spec.rb
476
476
  - spec/shared_contexts/with_workflow_run.rb
477
+ - spec/shared_contexts/with_live_photo.rb
478
+ - spec/shared_contexts/with_onfido.rb
477
479
  - spec/shared_contexts/with_document.rb
478
480
  - spec/shared_contexts/with_check.rb
479
- - spec/shared_contexts/with_live_photo.rb
481
+ - spec/shared_contexts/with_applicant.rb
480
482
  - spec/spec_helper.rb
481
483
  - spec/webhook_event_verifier_spec.rb