onfido 5.1.0 → 5.2.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: b50846731ee3d1258557cfbb22b8348d5328af3d2f8b0fba18548e37dc8963ea
4
- data.tar.gz: efef5ee6be4f2f839764d11e1fb00f23d24e554b1e1c5bbb33ec127fbe603534
3
+ metadata.gz: d9d1b25944b1a8260f459e08ea5fa12d445303f25066e75736c3d305ec77b52f
4
+ data.tar.gz: 700a5d91654fe610c6b95f206edf1d85366e06dd24ce9ff84fd95c8e89cc6cb1
5
5
  SHA512:
6
- metadata.gz: 7460854cfadcc65b683f1087130da5b23f46c3f1e9e4787b9aa5e82a5b8d394e3bea826fd085b70614d5d591e6ab78eff73365bd615ff8bc6e6e7f9f107d9680
7
- data.tar.gz: 567a9d3e0e751d042022ea2a41691485a1deedddaf91131f3c599e5390638f0e5155c855f4d58a233a69d0e2f3acd072e0f040d0ff022d0fe326a36034c29192
6
+ metadata.gz: 93a5c47f5302b73dd9666f85741c7c199731e9d6bb703b169d2dd3ec02521fac1fb1c5b1e0ee2402fe279e4e4d66b026ddc591e756dcf2d3da6c59a6c2ee589d
7
+ data.tar.gz: 683b92367a3e2ca427c7dbebbb5847927f45d61437786d78dd916d323e42fcebf78966196dc779a32998a6179ec3b49c1a089fb2dd9437c0856b4b9b80bcd9ae
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## v5.1.1 19th May 2025
4
+
5
+ - Release based on Onfido OpenAPI spec version [v5.1.1](https://github.com/onfido/onfido-openapi-spec/releases/tag/v5.1.1):
6
+ - [CAT-1952] Fix corruption in file download
7
+
8
+ ## v5.1.0 14th May 2025
9
+
10
+ - Release based on Onfido OpenAPI spec version [v5.1.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v5.1.0):
11
+ - CAT-1760: create get applicant consents endpoint
12
+ - Update Ruby library README template
13
+ - [CAT-1911] Fix document_with_driving_licence_information to be a list of objects
14
+ - [AF-1390] Fix: Device Intelligence Report Schema
15
+ - [CAT-1944] Add OAuth fields for Webhook authentication
16
+ - Fix storage of device_fingerprint_reuse breakdown and properties as float
17
+ - Add .markdownlint.json to templates
18
+
19
+ **DEPRECATION NOTICE**: This release has been **deprecated** in favour of [v5.1.1](#v511-19th-may-2025).
20
+
3
21
  ## v5.0.0 21st February 2025
4
22
 
5
23
  - Release based on Onfido OpenAPI spec version [v5.0.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v5.0.0):
@@ -16,6 +34,8 @@
16
34
  - Add tests for Download NFC Face endpoint
17
35
  - [Migration Guide](MIGRATION.md#upgrading-from-4x-to-5x)
18
36
 
37
+ **DEPRECATION NOTICE**: This release has been **deprecated** in favour of [v5.1.1](#v511-19th-may-2025).
38
+
19
39
  ## v4.6.0 24th January 2025
20
40
 
21
41
  - Release based on Onfido OpenAPI spec version [v4.6.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v4.6.0):
@@ -25,33 +45,45 @@
25
45
  - Add customer_user_id in the webhook event resource
26
46
  - test: wait for evidence folder to be available
27
47
 
48
+ **DEPRECATION NOTICE**: This release has been **deprecated** in favour of [v5.1.1](#v511-19th-may-2025).
49
+
28
50
  ## v4.5.0 8th January 2025
29
51
 
30
52
  - Release based on Onfido OpenAPI spec version [v4.5.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v4.5.0):
31
53
  - [STUDIO-4305] Add download evidence folder path
32
54
 
55
+ **DEPRECATION NOTICE**: This release has been **deprecated** in favour of [v5.1.1](#v511-19th-may-2025).
56
+
33
57
  ## v4.4.0 20th December 2024
34
58
 
35
59
  - Release based on Onfido OpenAPI spec version [v4.4.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v4.4.0):
36
60
  - [CAT-1593] Fix missing webhook type and evidence folder webhook
37
61
  - [CAT-1590] Allow any type for the workflow task output
38
62
 
63
+ **DEPRECATION NOTICE**: This release has been **deprecated** in favour of [v5.1.1](#v511-19th-may-2025).
64
+
39
65
  ## v4.3.0 27th November 2024
40
66
 
41
67
  - Release based on Onfido OpenAPI spec version [v4.3.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v4.3.0):
42
68
  - [CAT-1581] Revert "[CAT-1528] Fix barcode field in document properties object"
43
69
 
70
+ **DEPRECATION NOTICE**: This release has been **deprecated** in favour of [v5.1.1](#v511-19th-may-2025).
71
+
44
72
  ## v4.2.0 19th November 2024
45
73
 
46
74
  - Release based on Onfido OpenAPI spec version [v4.2.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v4.2.0):
47
75
  - feat: add new fields to facial similarity report objects
48
76
  - [CAT-1552] Add missing document types
49
77
 
78
+ **DEPRECATION NOTICE**: This release has been **deprecated** in favour of [v5.1.1](#v511-19th-may-2025).
79
+
50
80
  ## v4.1.0 8th November 2024
51
81
 
52
82
  - Release based on Onfido OpenAPI spec version [v4.1.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v4.1.0):
53
83
  - [CAT-1528] Fix barcode field in document properties object
54
84
 
85
+ **DEPRECATION NOTICE**: This release has been **deprecated** in favour of [v5.1.1](#v511-19th-may-2025).
86
+
55
87
  ## v4.0.0 24th October 2024
56
88
 
57
89
  - Release based on Onfido OpenAPI spec version [v4.0.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v4.0.0):
@@ -63,6 +95,8 @@
63
95
  - Upgrade OpenAPI generator to v7.9.0 (was v7.6.0)
64
96
  - [Migration Guide](MIGRATION.md#upgrading-from-3x-to-4x)
65
97
 
98
+ **DEPRECATION NOTICE**: This release has been **deprecated** in favour of [v5.1.1](#v511-19th-may-2025).
99
+
66
100
  ## v3.4.0 20th September 2024
67
101
 
68
102
  - Release based on Onfido OpenAPI spec version [v3.5.0](https://github.com/onfido/onfido-openapi-spec/releases/tag/v3.5.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', '~> 5.1.0'
17
+ gem 'onfido', '~> 5.2.0'
18
18
  ```
19
19
 
20
20
  Configure with your API token, region and optional timeout (default value is 30):
@@ -35,7 +35,7 @@ module Onfido
35
35
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
36
36
  def initialize(config = Configuration.default)
37
37
  @config = config
38
- @user_agent = "onfido-ruby/5.1.0"
38
+ @user_agent = "onfido-ruby/5.2.0"
39
39
  @default_headers = {
40
40
  'Content-Type' => 'application/json',
41
41
  'User-Agent' => @user_agent
@@ -175,7 +175,7 @@ module Onfido
175
175
 
176
176
  # reconstruct content
177
177
  content = stream.join
178
- content = content.unpack('m').join if response.headers['Content-Transfer-Encoding'] == 'binary'
178
+ content = content.unpack('m').join if response.headers['Content-Transfer-Encoding'] == 'base64'
179
179
  content = content.force_encoding(encoding)
180
180
 
181
181
  # return byte stream
@@ -52,6 +52,8 @@ module Onfido
52
52
 
53
53
  attr_accessor :us_driving_licence
54
54
 
55
+ attr_accessor :report_configuration
56
+
55
57
  # Attribute mapping from ruby-style variable name to JSON key.
56
58
  def self.attribute_map
57
59
  {
@@ -67,7 +69,8 @@ module Onfido
67
69
  :'suppress_form_emails' => :'suppress_form_emails',
68
70
  :'sub_result' => :'sub_result',
69
71
  :'consider' => :'consider',
70
- :'us_driving_licence' => :'us_driving_licence'
72
+ :'us_driving_licence' => :'us_driving_licence',
73
+ :'report_configuration' => :'report_configuration'
71
74
  }
72
75
  end
73
76
 
@@ -91,7 +94,8 @@ module Onfido
91
94
  :'suppress_form_emails' => :'Boolean',
92
95
  :'sub_result' => :'String',
93
96
  :'consider' => :'Array<ReportName>',
94
- :'us_driving_licence' => :'UsDrivingLicenceBuilder'
97
+ :'us_driving_licence' => :'UsDrivingLicenceBuilder',
98
+ :'report_configuration' => :'ReportConfiguration'
95
99
  }
96
100
  end
97
101
 
@@ -193,6 +197,10 @@ module Onfido
193
197
  if attributes.key?(:'us_driving_licence')
194
198
  self.us_driving_licence = attributes[:'us_driving_licence']
195
199
  end
200
+
201
+ if attributes.key?(:'report_configuration')
202
+ self.report_configuration = attributes[:'report_configuration']
203
+ end
196
204
  end
197
205
 
198
206
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -237,7 +245,8 @@ module Onfido
237
245
  suppress_form_emails == o.suppress_form_emails &&
238
246
  sub_result == o.sub_result &&
239
247
  consider == o.consider &&
240
- us_driving_licence == o.us_driving_licence
248
+ us_driving_licence == o.us_driving_licence &&
249
+ report_configuration == o.report_configuration
241
250
  end
242
251
 
243
252
  # @see the `==` method
@@ -249,7 +258,7 @@ module Onfido
249
258
  # Calculates hash code according to all attributes.
250
259
  # @return [Integer] Hash code
251
260
  def hash
252
- [webhook_ids, applicant_id, applicant_provides_data, tags, redirect_uri, privacy_notices_read_consent_given, report_names, document_ids, asynchronous, suppress_form_emails, sub_result, consider, us_driving_licence].hash
261
+ [webhook_ids, applicant_id, applicant_provides_data, tags, redirect_uri, privacy_notices_read_consent_given, report_names, document_ids, asynchronous, suppress_form_emails, sub_result, consider, us_driving_licence, report_configuration].hash
253
262
  end
254
263
 
255
264
  # Builds the object from hash
@@ -38,6 +38,8 @@ module Onfido
38
38
 
39
39
  attr_accessor :us_driving_licence
40
40
 
41
+ attr_accessor :report_configuration
42
+
41
43
  # Attribute mapping from ruby-style variable name to JSON key.
42
44
  def self.attribute_map
43
45
  {
@@ -48,7 +50,8 @@ module Onfido
48
50
  :'suppress_form_emails' => :'suppress_form_emails',
49
51
  :'sub_result' => :'sub_result',
50
52
  :'consider' => :'consider',
51
- :'us_driving_licence' => :'us_driving_licence'
53
+ :'us_driving_licence' => :'us_driving_licence',
54
+ :'report_configuration' => :'report_configuration'
52
55
  }
53
56
  end
54
57
 
@@ -67,7 +70,8 @@ module Onfido
67
70
  :'suppress_form_emails' => :'Boolean',
68
71
  :'sub_result' => :'String',
69
72
  :'consider' => :'Array<ReportName>',
70
- :'us_driving_licence' => :'UsDrivingLicenceBuilder'
73
+ :'us_driving_licence' => :'UsDrivingLicenceBuilder',
74
+ :'report_configuration' => :'ReportConfiguration'
71
75
  }
72
76
  end
73
77
 
@@ -135,6 +139,10 @@ module Onfido
135
139
  if attributes.key?(:'us_driving_licence')
136
140
  self.us_driving_licence = attributes[:'us_driving_licence']
137
141
  end
142
+
143
+ if attributes.key?(:'report_configuration')
144
+ self.report_configuration = attributes[:'report_configuration']
145
+ end
138
146
  end
139
147
 
140
148
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -169,7 +177,8 @@ module Onfido
169
177
  suppress_form_emails == o.suppress_form_emails &&
170
178
  sub_result == o.sub_result &&
171
179
  consider == o.consider &&
172
- us_driving_licence == o.us_driving_licence
180
+ us_driving_licence == o.us_driving_licence &&
181
+ report_configuration == o.report_configuration
173
182
  end
174
183
 
175
184
  # @see the `==` method
@@ -181,7 +190,7 @@ module Onfido
181
190
  # Calculates hash code according to all attributes.
182
191
  # @return [Integer] Hash code
183
192
  def hash
184
- [report_names, document_ids, applicant_provides_data, asynchronous, suppress_form_emails, sub_result, consider, us_driving_licence].hash
193
+ [report_names, document_ids, applicant_provides_data, asynchronous, suppress_form_emails, sub_result, consider, us_driving_licence, report_configuration].hash
185
194
  end
186
195
 
187
196
  # Builds the object from hash
@@ -0,0 +1,242 @@
1
+ =begin
2
+ #Onfido API v3.6
3
+
4
+ #The Onfido API (v3.6)
5
+
6
+ The version of the OpenAPI document: v3.6
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Onfido
17
+ # Defines configuration options for facial similarity checks used to distinguish between onboarding and reverification scenarios.
18
+ class ReportConfiguration
19
+ attr_accessor :facial_similarity_photo
20
+
21
+ attr_accessor :facial_similarity_photo_fully_auto
22
+
23
+ attr_accessor :facial_similarity_video
24
+
25
+ attr_accessor :facial_similarity_motion
26
+
27
+ # Attribute mapping from ruby-style variable name to JSON key.
28
+ def self.attribute_map
29
+ {
30
+ :'facial_similarity_photo' => :'facial_similarity_photo',
31
+ :'facial_similarity_photo_fully_auto' => :'facial_similarity_photo_fully_auto',
32
+ :'facial_similarity_video' => :'facial_similarity_video',
33
+ :'facial_similarity_motion' => :'facial_similarity_motion'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'facial_similarity_photo' => :'ReportConfigurationFacialSimilarity',
46
+ :'facial_similarity_photo_fully_auto' => :'ReportConfigurationFacialSimilarity',
47
+ :'facial_similarity_video' => :'ReportConfigurationFacialSimilarity',
48
+ :'facial_similarity_motion' => :'ReportConfigurationFacialSimilarity'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ if (!attributes.is_a?(Hash))
62
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ReportConfiguration` initialize method"
63
+ end
64
+
65
+ # check to see if the attribute exists and convert string to symbol for hash key
66
+ attributes = attributes.each_with_object({}) { |(k, v), h|
67
+ if (!self.class.attribute_map.key?(k.to_sym))
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ReportConfiguration`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
69
+ end
70
+ h[k.to_sym] = v
71
+ }
72
+
73
+ if attributes.key?(:'facial_similarity_photo')
74
+ self.facial_similarity_photo = attributes[:'facial_similarity_photo']
75
+ end
76
+
77
+ if attributes.key?(:'facial_similarity_photo_fully_auto')
78
+ self.facial_similarity_photo_fully_auto = attributes[:'facial_similarity_photo_fully_auto']
79
+ end
80
+
81
+ if attributes.key?(:'facial_similarity_video')
82
+ self.facial_similarity_video = attributes[:'facial_similarity_video']
83
+ end
84
+
85
+ if attributes.key?(:'facial_similarity_motion')
86
+ self.facial_similarity_motion = attributes[:'facial_similarity_motion']
87
+ end
88
+ end
89
+
90
+ # Show invalid properties with the reasons. Usually used together with valid?
91
+ # @return Array for valid properties with the reasons
92
+ def list_invalid_properties
93
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
94
+ invalid_properties = Array.new
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ warn '[DEPRECATED] the `valid?` method is obsolete'
102
+ true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ facial_similarity_photo == o.facial_similarity_photo &&
111
+ facial_similarity_photo_fully_auto == o.facial_similarity_photo_fully_auto &&
112
+ facial_similarity_video == o.facial_similarity_video &&
113
+ facial_similarity_motion == o.facial_similarity_motion
114
+ end
115
+
116
+ # @see the `==` method
117
+ # @param [Object] Object to be compared
118
+ def eql?(o)
119
+ self == o
120
+ end
121
+
122
+ # Calculates hash code according to all attributes.
123
+ # @return [Integer] Hash code
124
+ def hash
125
+ [facial_similarity_photo, facial_similarity_photo_fully_auto, facial_similarity_video, facial_similarity_motion].hash
126
+ end
127
+
128
+ # Builds the object from hash
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ # @return [Object] Returns the model itself
131
+ def self.build_from_hash(attributes)
132
+ return nil unless attributes.is_a?(Hash)
133
+ attributes = attributes.transform_keys(&:to_sym)
134
+ transformed_hash = {}
135
+ openapi_types.each_pair do |key, type|
136
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
137
+ transformed_hash["#{key}"] = nil
138
+ elsif type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[attribute_map[key]].is_a?(Array)
142
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
143
+ end
144
+ elsif !attributes[attribute_map[key]].nil?
145
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
146
+ end
147
+ end
148
+ new(transformed_hash)
149
+ end
150
+
151
+ # Deserializes the data based on type
152
+ # @param string type Data type
153
+ # @param string value Value to be deserialized
154
+ # @return [Object] Deserialized data
155
+ def self._deserialize(type, value)
156
+ case type.to_sym
157
+ when :Time
158
+ Time.parse(value)
159
+ when :Date
160
+ Date.parse(value)
161
+ when :String
162
+ value.to_s
163
+ when :Integer
164
+ value.to_i
165
+ when :Float
166
+ value.to_f
167
+ when :Boolean
168
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
169
+ true
170
+ else
171
+ false
172
+ end
173
+ when :Object
174
+ # generic object (usually a Hash), return directly
175
+ value
176
+ when /\AArray<(?<inner_type>.+)>\z/
177
+ inner_type = Regexp.last_match[:inner_type]
178
+ value.map { |v| _deserialize(inner_type, v) }
179
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
180
+ k_type = Regexp.last_match[:k_type]
181
+ v_type = Regexp.last_match[:v_type]
182
+ {}.tap do |hash|
183
+ value.each do |k, v|
184
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
185
+ end
186
+ end
187
+ else # model
188
+ # models (e.g. Pet) or oneOf
189
+ klass = Onfido.const_get(type)
190
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
191
+ end
192
+ end
193
+
194
+ # Returns the string representation of the object
195
+ # @return [String] String presentation of the object
196
+ def to_s
197
+ to_hash.to_s
198
+ end
199
+
200
+ # to_body is an alias to to_hash (backward compatibility)
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_body
203
+ to_hash
204
+ end
205
+
206
+ # Returns the object in the form of hash
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_hash
209
+ hash = {}
210
+ self.class.attribute_map.each_pair do |attr, param|
211
+ value = self.send(attr)
212
+ if value.nil?
213
+ is_nullable = self.class.openapi_nullable.include?(attr)
214
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
215
+ end
216
+
217
+ hash[param] = _to_hash(value)
218
+ end
219
+ hash
220
+ end
221
+
222
+ # Outputs non-array value in the form of hash
223
+ # For object, use to_hash. Otherwise, just return the value
224
+ # @param [Object] value Any valid value
225
+ # @return [Hash] Returns the value in the form of hash
226
+ def _to_hash(value)
227
+ if value.is_a?(Array)
228
+ value.compact.map { |v| _to_hash(v) }
229
+ elsif value.is_a?(Hash)
230
+ {}.tap do |hash|
231
+ value.each { |k, v| hash[k] = _to_hash(v) }
232
+ end
233
+ elsif value.respond_to? :to_hash
234
+ value.to_hash
235
+ else
236
+ value
237
+ end
238
+ end
239
+
240
+ end
241
+
242
+ end
@@ -0,0 +1,249 @@
1
+ =begin
2
+ #Onfido API v3.6
3
+
4
+ #The Onfido API (v3.6)
5
+
6
+ The version of the OpenAPI document: v3.6
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.11.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Onfido
17
+ class ReportConfigurationFacialSimilarity
18
+ # You should set it to \"reverification\" on a post-onboarding scenario (e.g. ongoing authentication).
19
+ attr_accessor :use_case
20
+
21
+ class EnumAttributeValidator
22
+ attr_reader :datatype
23
+ attr_reader :allowable_values
24
+
25
+ def initialize(datatype, allowable_values)
26
+ @allowable_values = allowable_values.map do |value|
27
+ case datatype.to_s
28
+ when /Integer/i
29
+ value.to_i
30
+ when /Float/i
31
+ value.to_f
32
+ else
33
+ value
34
+ end
35
+ end
36
+ end
37
+
38
+ def valid?(value)
39
+ !value || allowable_values.include?(value)
40
+ end
41
+ end
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+ :'use_case' => :'use_case'
47
+ }
48
+ end
49
+
50
+ # Returns all the JSON keys this model knows about
51
+ def self.acceptable_attributes
52
+ attribute_map.values
53
+ end
54
+
55
+ # Attribute type mapping.
56
+ def self.openapi_types
57
+ {
58
+ :'use_case' => :'String'
59
+ }
60
+ end
61
+
62
+ # List of attributes with nullable: true
63
+ def self.openapi_nullable
64
+ Set.new([
65
+ ])
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::ReportConfigurationFacialSimilarity` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ attributes = attributes.each_with_object({}) { |(k, v), h|
77
+ if (!self.class.attribute_map.key?(k.to_sym))
78
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::ReportConfigurationFacialSimilarity`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
79
+ end
80
+ h[k.to_sym] = v
81
+ }
82
+
83
+ if attributes.key?(:'use_case')
84
+ self.use_case = attributes[:'use_case']
85
+ end
86
+ end
87
+
88
+ # Show invalid properties with the reasons. Usually used together with valid?
89
+ # @return Array for valid properties with the reasons
90
+ def list_invalid_properties
91
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
92
+ invalid_properties = Array.new
93
+ invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ warn '[DEPRECATED] the `valid?` method is obsolete'
100
+ use_case_validator = EnumAttributeValidator.new('String', ["onboarding", "reverification", "unknown_default_open_api"])
101
+ return false unless use_case_validator.valid?(@use_case)
102
+ true
103
+ end
104
+
105
+ # Custom attribute writer method checking allowed values (enum).
106
+ # @param [Object] use_case Object to be assigned
107
+ def use_case=(use_case)
108
+ validator = EnumAttributeValidator.new('String', ["onboarding", "reverification", "unknown_default_open_api"])
109
+ unless validator.valid?(use_case)
110
+ fail ArgumentError, "invalid value for \"use_case\", must be one of #{validator.allowable_values}."
111
+ end
112
+ @use_case = use_case
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(o)
118
+ return true if self.equal?(o)
119
+ self.class == o.class &&
120
+ use_case == o.use_case
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Integer] Hash code
131
+ def hash
132
+ [use_case].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def self.build_from_hash(attributes)
139
+ return nil unless attributes.is_a?(Hash)
140
+ attributes = attributes.transform_keys(&:to_sym)
141
+ transformed_hash = {}
142
+ openapi_types.each_pair do |key, type|
143
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = nil
145
+ elsif type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[attribute_map[key]].is_a?(Array)
149
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
150
+ end
151
+ elsif !attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
153
+ end
154
+ end
155
+ new(transformed_hash)
156
+ end
157
+
158
+ # Deserializes the data based on type
159
+ # @param string type Data type
160
+ # @param string value Value to be deserialized
161
+ # @return [Object] Deserialized data
162
+ def self._deserialize(type, value)
163
+ case type.to_sym
164
+ when :Time
165
+ Time.parse(value)
166
+ when :Date
167
+ Date.parse(value)
168
+ when :String
169
+ value.to_s
170
+ when :Integer
171
+ value.to_i
172
+ when :Float
173
+ value.to_f
174
+ when :Boolean
175
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
176
+ true
177
+ else
178
+ false
179
+ end
180
+ when :Object
181
+ # generic object (usually a Hash), return directly
182
+ value
183
+ when /\AArray<(?<inner_type>.+)>\z/
184
+ inner_type = Regexp.last_match[:inner_type]
185
+ value.map { |v| _deserialize(inner_type, v) }
186
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
187
+ k_type = Regexp.last_match[:k_type]
188
+ v_type = Regexp.last_match[:v_type]
189
+ {}.tap do |hash|
190
+ value.each do |k, v|
191
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
192
+ end
193
+ end
194
+ else # model
195
+ # models (e.g. Pet) or oneOf
196
+ klass = Onfido.const_get(type)
197
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
198
+ end
199
+ end
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # to_body is an alias to to_hash (backward compatibility)
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_body
210
+ to_hash
211
+ end
212
+
213
+ # Returns the object in the form of hash
214
+ # @return [Hash] Returns the object in the form of hash
215
+ def to_hash
216
+ hash = {}
217
+ self.class.attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Outputs non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ # @param [Object] value Any valid value
232
+ # @return [Hash] Returns the value in the form of hash
233
+ def _to_hash(value)
234
+ if value.is_a?(Array)
235
+ value.compact.map { |v| _to_hash(v) }
236
+ elsif value.is_a?(Hash)
237
+ {}.tap do |hash|
238
+ value.each { |k, v| hash[k] = _to_hash(v) }
239
+ end
240
+ elsif value.respond_to? :to_hash
241
+ value.to_hash
242
+ else
243
+ value
244
+ end
245
+ end
246
+
247
+ end
248
+
249
+ end
@@ -11,5 +11,5 @@ Generator version: 7.11.0
11
11
  =end
12
12
 
13
13
  module Onfido
14
- VERSION = '5.1.0'
14
+ VERSION = '5.2.0'
15
15
  end
data/lib/onfido.rb CHANGED
@@ -228,6 +228,8 @@ require 'onfido/models/proof_of_address_report'
228
228
  require 'onfido/models/repeat_attempts_list'
229
229
  require 'onfido/models/repeat_attempts_list_repeat_attempts_inner'
230
230
  require 'onfido/models/report'
231
+ require 'onfido/models/report_configuration'
232
+ require 'onfido/models/report_configuration_facial_similarity'
231
233
  require 'onfido/models/report_document'
232
234
  require 'onfido/models/report_name'
233
235
  require 'onfido/models/report_result'
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../shared_contexts/with_check'
4
+ require_relative '../shared_examples/file_examples'
4
5
 
5
6
  describe Onfido::Check do
6
7
  describe 'Checks' do
@@ -74,10 +75,10 @@ describe Onfido::Check do
74
75
  onfido_api.resume_check(check_id)
75
76
  end
76
77
 
77
- it 'downloads a check' do
78
- file = onfido_api.download_check(check_id)
78
+ describe 'downloading a check' do
79
+ let(:file) { onfido_api.download_check(check_id) }
79
80
 
80
- expect(file.size).to be > 0
81
+ it_behaves_like "a valid PDF file"
81
82
  end
82
83
  end
83
84
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../shared_contexts/with_document'
4
+ require_relative '../shared_examples/file_examples'
4
5
 
5
6
  describe Onfido::Document do
6
7
  describe 'Documents' do
@@ -27,10 +28,10 @@ describe Onfido::Document do
27
28
  expect(get_document.id).to eq document_id
28
29
  end
29
30
 
30
- it 'downloads a document' do
31
- file = onfido_api.download_document(document_id)
31
+ describe 'downloading a document' do
32
+ let(:file) { onfido_api.download_document(document_id) }
32
33
 
33
- expect(file.size).to be > 0
34
+ it_behaves_like "a valid PNG file", 361771
34
35
  end
35
36
 
36
37
  it 'cannot download an inexistent document' do
@@ -41,10 +42,10 @@ describe Onfido::Document do
41
42
  }
42
43
  end
43
44
 
44
- it 'downloads an NFC face' do
45
- file = onfido_api.download_nfc_face(nfc_face_id)
45
+ describe 'downloading an NFC face' do
46
+ let(:file) { onfido_api.download_nfc_face(nfc_face_id) }
46
47
 
47
- expect(file.size).to be > 0
48
+ it_behaves_like "a valid PNG file", 471345
48
49
  end
49
50
 
50
51
  it 'cannot download an inexistent NFC face' do
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../shared_contexts/with_applicant'
4
+ require_relative '../shared_examples/file_examples'
4
5
 
5
6
  describe Onfido::IdPhoto do
6
7
  describe 'Id Photo' do
@@ -35,10 +36,10 @@ describe Onfido::IdPhoto do
35
36
  expect(get_id_photo.id).to eq id_photo_id
36
37
  end
37
38
 
38
- it 'downloads id photo' do
39
- file = onfido_api.download_id_photo(id_photo_id)
39
+ describe 'downloading id photo' do
40
+ let(:file) { onfido_api.download_id_photo(id_photo_id) }
40
41
 
41
- expect(file.length).to be > 0
42
+ it_behaves_like "a valid PNG file", 395856
42
43
  end
43
44
 
44
45
  it 'raises an error with the correct status code when trying to download an inexistent id photo' do
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../shared_contexts/with_live_photo'
4
+ require_relative '../shared_examples/file_examples'
4
5
 
5
6
  describe Onfido::LivePhoto do
6
7
  describe 'Live Photo' do
@@ -27,10 +28,10 @@ describe Onfido::LivePhoto do
27
28
  expect(live_photo).to be_an_instance_of Onfido::LivePhoto
28
29
  end
29
30
 
30
- it 'downloads live photo' do
31
- file = onfido_api.download_live_photo(live_photo_id)
31
+ describe 'downloading live photo' do
32
+ let(:file) { onfido_api.download_live_photo(live_photo_id) }
32
33
 
33
- expect(file.length).to be > 0
34
+ it_behaves_like "a valid PNG file", 395856
34
35
  end
35
36
 
36
37
  it 'raises an error with the correct status code when trying to download an inexistent live photo' do
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../shared_contexts/with_onfido'
4
+ require_relative '../shared_examples/file_examples'
4
5
 
5
6
  describe Onfido::LiveVideo do
6
7
  describe 'Live Video' do
@@ -24,16 +25,16 @@ describe Onfido::LiveVideo do
24
25
  expect(get_live_video).to be_an_instance_of Onfido::LiveVideo
25
26
  end
26
27
 
27
- it 'downloads live video' do
28
- file = onfido_api.download_live_video(live_video_id)
28
+ describe 'downloading live video' do
29
+ let(:file) { onfido_api.download_live_video(live_video_id) }
29
30
 
30
- expect(file.length).to be > 0
31
+ it_behaves_like "a valid MP4 file", 165093
31
32
  end
32
33
 
33
- it 'downloads live video frame' do
34
- file = onfido_api.download_live_video_frame(live_video_id)
34
+ describe 'downloading live video frame' do
35
+ let(:file) { onfido_api.download_live_video_frame(live_video_id) }
35
36
 
36
- expect(file.length).to be > 0
37
+ it_behaves_like "a valid JPEG file", 1692
37
38
  end
38
39
 
39
40
  it 'raises an error with the correct status code when trying to download an inexistent live video' do
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../shared_contexts/with_onfido'
4
+ require_relative '../shared_examples/file_examples'
4
5
 
5
6
  describe Onfido::MotionCapture do
6
7
  describe 'Motion Capture' do
@@ -24,16 +25,16 @@ describe Onfido::MotionCapture do
24
25
  expect(get_motion_capture).to be_an_instance_of Onfido::MotionCapture
25
26
  end
26
27
 
27
- it 'downloads motion capture' do
28
- file = onfido_api.download_motion_capture(motion_id)
28
+ describe 'downloading live video' do
29
+ let(:file) { onfido_api.download_motion_capture(motion_id) }
29
30
 
30
- expect(file.length).to be > 0
31
+ it_behaves_like "a valid MP4 file", 2720276
31
32
  end
32
33
 
33
- it 'downloads motion capture frame' do
34
- file = onfido_api.download_motion_capture_frame(motion_id)
34
+ describe 'downloading live video frame' do
35
+ let(:file) { onfido_api.download_motion_capture_frame(motion_id) }
35
36
 
36
- expect(file.length).to be > 0
37
+ it_behaves_like "a valid JPEG file", 75627
37
38
  end
38
39
 
39
40
  it 'raises an error with the correct status code when trying to download an inexistent motion capture' do
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative '../shared_contexts/with_workflow_run'
4
+ require_relative '../shared_examples/file_examples'
5
+
4
6
  require 'zip'
5
7
 
6
8
  describe Onfido::WorkflowRun do
@@ -47,10 +49,10 @@ describe Onfido::WorkflowRun do
47
49
  expect(get_workflow_run.id).to eq workflow_run_id
48
50
  end
49
51
 
50
- it 'downloads evidence file' do
51
- file = onfido_api.download_signed_evidence_file(workflow_run_id)
52
+ describe 'downloading evidence file' do
53
+ let(:file) { onfido_api.download_signed_evidence_file(workflow_run_id) }
52
54
 
53
- expect(file.size).to be > 0
55
+ it_behaves_like "a valid PDF file", 497605
54
56
  end
55
57
 
56
58
  context 'with start -> approved workflow' do
@@ -78,7 +80,7 @@ describe Onfido::WorkflowRun do
78
80
  onfido_api.find_timeline_file(workflow_run_id, timeline_file_id)
79
81
  end
80
82
 
81
- expect(file.size).to be > 0
83
+ expect(file.size).to be > 100000
82
84
  end
83
85
 
84
86
  it 'downloads an evidence folder' do
@@ -87,7 +89,7 @@ describe Onfido::WorkflowRun do
87
89
  end
88
90
 
89
91
  Zip::File.open(file.path) do |zip|
90
- expect(zip.entries.size).to be > 0
92
+ expect(zip.entries.size).to be > 1
91
93
  end
92
94
  end
93
95
  end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.shared_examples_for "a valid file" do |expected_size|
4
+ it "is not nil and has a size greater than 0" do
5
+ expect(file).not_to be_nil
6
+ expect(file.size).to be > 0
7
+ end
8
+
9
+ it "has the expected file size" do
10
+ expect(file.size).to equal expected_size if expected_size
11
+ end
12
+ end
13
+
14
+ RSpec.shared_examples_for "a file with signature" do |signature, offset, length|
15
+ it "has a valid signature" do
16
+ signature_to_check = String.new(signature, encoding: 'BINARY')
17
+
18
+ File.open(file.path, 'rb') do |file_handler|
19
+ file_handler.rewind
20
+ content = file_handler.read(offset + length)
21
+ expect(content[offset, length]).to eq(signature_to_check)
22
+ end
23
+ end
24
+ end
25
+
26
+ RSpec.shared_examples_for "a valid PNG file" do |expected_size|
27
+ include_examples "a valid file", expected_size
28
+ include_examples "a file with signature", "\x89PNG\r\n\x1A\n", 0, 8
29
+ end
30
+
31
+ RSpec.shared_examples_for "a valid PDF file" do |expected_size|
32
+ include_examples "a valid file", expected_size
33
+ include_examples "a file with signature", "%PDF-", 0, 5
34
+ end
35
+
36
+ RSpec.shared_examples_for "a valid JPEG file" do |expected_size|
37
+ include_examples "a valid file", expected_size
38
+ include_examples "a file with signature", "\xFF\xD8\xFF\xE0\x00\x10JF", 0, 8
39
+ end
40
+
41
+ RSpec.shared_examples_for "a valid MP4 file" do |expected_size|
42
+ include_examples "a valid file", expected_size
43
+ include_examples "a file with signature", "ftyp", 4, 4
44
+ end
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: 5.1.0
4
+ version: 5.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: 2025-05-14 00:00:00.000000000 Z
11
+ date: 2025-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -349,6 +349,8 @@ files:
349
349
  - lib/onfido/models/repeat_attempts_list.rb
350
350
  - lib/onfido/models/repeat_attempts_list_repeat_attempts_inner.rb
351
351
  - lib/onfido/models/report.rb
352
+ - lib/onfido/models/report_configuration.rb
353
+ - lib/onfido/models/report_configuration_facial_similarity.rb
352
354
  - lib/onfido/models/report_document.rb
353
355
  - lib/onfido/models/report_name.rb
354
356
  - lib/onfido/models/report_result.rb
@@ -463,6 +465,7 @@ files:
463
465
  - spec/shared_contexts/with_live_photo.rb
464
466
  - spec/shared_contexts/with_onfido.rb
465
467
  - spec/shared_contexts/with_workflow_run.rb
468
+ - spec/shared_examples/file_examples.rb
466
469
  - spec/spec_helper.rb
467
470
  - spec/studio_webhook_event_verifier_spec.rb
468
471
  homepage: https://github.com/onfido/onfido-ruby
@@ -490,33 +493,34 @@ specification_version: 4
490
493
  summary: The official Ruby library for integrating with the Onfido API.
491
494
  test_files:
492
495
  - spec/classic_webhook_event_verifier_spec.rb
493
- - spec/integrations/motion_capture_spec.rb
494
- - spec/integrations/id_photo_spec.rb
495
- - spec/integrations/check_spec.rb
496
+ - spec/integrations/report_schema_spec.rb
497
+ - spec/integrations/extraction_spec.rb
498
+ - spec/integrations/workflow_run_spec.rb
496
499
  - spec/integrations/live_photo_spec.rb
497
500
  - spec/integrations/watchlist_monitor_spec.rb
498
- - spec/integrations/workflow_run_output_spec.rb
499
- - spec/integrations/media/sample_photo.png
500
- - spec/integrations/media/sample_driving_licence.png
501
- - spec/integrations/live_video_spec.rb
501
+ - spec/integrations/sdk_token_spec.rb
502
502
  - spec/integrations/document_spec.rb
503
- - spec/integrations/webhook_spec.rb
504
- - spec/integrations/applicant_spec.rb
503
+ - spec/integrations/tasks_spec.rb
504
+ - spec/integrations/media/sample_driving_licence.png
505
+ - spec/integrations/media/sample_photo.png
506
+ - spec/integrations/workflow_run_output_spec.rb
507
+ - spec/integrations/id_photo_spec.rb
505
508
  - spec/integrations/address_picker_spec.rb
506
- - spec/integrations/workflow_run_spec.rb
509
+ - spec/integrations/live_video_spec.rb
507
510
  - spec/integrations/qualified_electronic_signature_spec.rb
508
- - spec/integrations/report_schema_spec.rb
509
- - spec/integrations/sdk_token_spec.rb
510
- - spec/integrations/tasks_spec.rb
511
511
  - spec/integrations/report_spec.rb
512
- - spec/integrations/extraction_spec.rb
513
- - spec/media/studio_webhook_event_with_object_in_output.json
512
+ - spec/integrations/check_spec.rb
513
+ - spec/integrations/webhook_spec.rb
514
+ - spec/integrations/applicant_spec.rb
515
+ - spec/integrations/motion_capture_spec.rb
514
516
  - spec/media/studio_webhook_event_with_list_in_output.json
515
- - spec/shared_contexts/with_applicant.rb
517
+ - spec/media/studio_webhook_event_with_object_in_output.json
516
518
  - spec/shared_contexts/with_check.rb
517
- - spec/shared_contexts/with_workflow_run.rb
518
- - spec/shared_contexts/with_onfido.rb
519
+ - spec/shared_contexts/with_applicant.rb
519
520
  - spec/shared_contexts/with_live_photo.rb
521
+ - spec/shared_contexts/with_onfido.rb
522
+ - spec/shared_contexts/with_workflow_run.rb
520
523
  - spec/shared_contexts/with_document.rb
524
+ - spec/shared_examples/file_examples.rb
521
525
  - spec/spec_helper.rb
522
526
  - spec/studio_webhook_event_verifier_spec.rb