onfido 6.1.0 → 6.3.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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +17 -1
  4. data/lib/onfido/api/default_api.rb +492 -79
  5. data/lib/onfido/api_client.rb +6 -2
  6. data/lib/onfido/configuration.rb +88 -0
  7. data/lib/onfido/models/biometric_token.rb +265 -0
  8. data/lib/onfido/models/biometric_token_data.rb +317 -0
  9. data/lib/onfido/models/biometric_token_response.rb +237 -0
  10. data/lib/onfido/models/biometric_token_updater.rb +262 -0
  11. data/lib/onfido/models/biometric_tokens_response.rb +239 -0
  12. data/lib/onfido/models/document_types.rb +3 -1
  13. data/lib/onfido/models/invalidated_biometric_token_response.rb +237 -0
  14. data/lib/onfido/models/invalidated_biometric_token_summary.rb +238 -0
  15. data/lib/onfido/models/invalidated_biometric_token_summary_deleted_items.rb +239 -0
  16. data/lib/onfido/models/invalidated_biometric_tokens_response.rb +237 -0
  17. data/lib/onfido/models/updated_biometric_token_response.rb +237 -0
  18. data/lib/onfido/models/watchlist_mesh_added_mentions.rb +247 -0
  19. data/lib/onfido/models/watchlist_mesh_alert_risk.rb +323 -0
  20. data/lib/onfido/models/watchlist_mesh_alert_risk1.rb +316 -0
  21. data/lib/onfido/models/watchlist_mesh_associate.rb +231 -0
  22. data/lib/onfido/models/watchlist_mesh_date_value.rb +231 -0
  23. data/lib/onfido/models/watchlist_mesh_field.rb +241 -0
  24. data/lib/onfido/models/watchlist_mesh_image.rb +231 -0
  25. data/lib/onfido/models/watchlist_mesh_lists.rb +309 -0
  26. data/lib/onfido/models/watchlist_mesh_media.rb +261 -0
  27. data/lib/onfido/models/watchlist_mesh_name.rb +231 -0
  28. data/lib/onfido/models/watchlist_mesh_pep.rb +369 -0
  29. data/lib/onfido/models/watchlist_mesh_person.rb +283 -0
  30. data/lib/onfido/models/watchlist_mesh_profile.rb +273 -0
  31. data/lib/onfido/models/watchlist_mesh_risk_decision.rb +43 -0
  32. data/lib/onfido/models/watchlist_mesh_risk_detail.rb +255 -0
  33. data/lib/onfido/models/watchlist_mesh_risk_indicators.rb +271 -0
  34. data/lib/onfido/models/watchlist_mesh_sanctions.rb +309 -0
  35. data/lib/onfido/models/webhook.rb +11 -1
  36. data/lib/onfido/models/webhook_builder.rb +11 -1
  37. data/lib/onfido/models/webhook_create.rb +11 -1
  38. data/lib/onfido/models/webhook_response.rb +11 -1
  39. data/lib/onfido/models/webhook_update.rb +11 -1
  40. data/lib/onfido/models/webhook_updater.rb +11 -1
  41. data/lib/onfido/version.rb +1 -1
  42. data/lib/onfido.rb +27 -0
  43. data/spec/integrations/biometric_token_spec.rb +122 -0
  44. data/spec/integrations/document_spec.rb +8 -1
  45. data/spec/integrations/media/nfc_data.json +11768 -0
  46. data/spec/integrations/watchlist_alert_risk_spec.rb +66 -0
  47. data/spec/shared_contexts/with_document.rb +0 -1
  48. data/spec/shared_contexts/with_onfido.rb +14 -2
  49. data/spec/spec_helper.rb +6 -7
  50. metadata +57 -24
@@ -0,0 +1,247 @@
1
+ =begin
2
+ #Onfido Public API v3.6
3
+
4
+ #The Onfido Public 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.16.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Onfido
17
+ class WatchlistMeshAddedMentions
18
+ attr_accessor :added_aml_types
19
+
20
+ attr_accessor :added_snippets
21
+
22
+ attr_accessor :added_listings
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'added_aml_types' => :'added_aml_types',
28
+ :'added_snippets' => :'added_snippets',
29
+ :'added_listings' => :'added_listings'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'added_aml_types' => :'Array<String>',
47
+ :'added_snippets' => :'Array<String>',
48
+ :'added_listings' => :'Array<String>'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ :'added_aml_types',
56
+ :'added_snippets',
57
+ :'added_listings'
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistMeshAddedMentions` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ acceptable_attribute_map = self.class.acceptable_attribute_map
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!acceptable_attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistMeshAddedMentions`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'added_aml_types')
78
+ if (value = attributes[:'added_aml_types']).is_a?(Array)
79
+ self.added_aml_types = value
80
+ end
81
+ end
82
+
83
+ if attributes.key?(:'added_snippets')
84
+ if (value = attributes[:'added_snippets']).is_a?(Array)
85
+ self.added_snippets = value
86
+ end
87
+ end
88
+
89
+ if attributes.key?(:'added_listings')
90
+ if (value = attributes[:'added_listings']).is_a?(Array)
91
+ self.added_listings = value
92
+ end
93
+ end
94
+ end
95
+
96
+ # Show invalid properties with the reasons. Usually used together with valid?
97
+ # @return Array for valid properties with the reasons
98
+ def list_invalid_properties
99
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
100
+ invalid_properties = Array.new
101
+ invalid_properties
102
+ end
103
+
104
+ # Check to see if the all the properties in the model are valid
105
+ # @return true if the model is valid
106
+ def valid?
107
+ warn '[DEPRECATED] the `valid?` method is obsolete'
108
+ true
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ added_aml_types == o.added_aml_types &&
117
+ added_snippets == o.added_snippets &&
118
+ added_listings == o.added_listings
119
+ end
120
+
121
+ # @see the `==` method
122
+ # @param [Object] Object to be compared
123
+ def eql?(o)
124
+ self == o
125
+ end
126
+
127
+ # Calculates hash code according to all attributes.
128
+ # @return [Integer] Hash code
129
+ def hash
130
+ [added_aml_types, added_snippets, added_listings].hash
131
+ end
132
+
133
+ # Builds the object from hash
134
+ # @param [Hash] attributes Model attributes in the form of hash
135
+ # @return [Object] Returns the model itself
136
+ def self.build_from_hash(attributes)
137
+ return nil unless attributes.is_a?(Hash)
138
+ attributes = attributes.transform_keys(&:to_sym)
139
+ transformed_hash = {}
140
+ openapi_types.each_pair do |key, type|
141
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
142
+ transformed_hash["#{key}"] = nil
143
+ elsif type =~ /\AArray<(.*)>/i
144
+ # check to ensure the input is an array given that the attribute
145
+ # is documented as an array but the input is not
146
+ if attributes[attribute_map[key]].is_a?(Array)
147
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
148
+ end
149
+ elsif !attributes[attribute_map[key]].nil?
150
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
151
+ end
152
+ end
153
+ new(transformed_hash)
154
+ end
155
+
156
+ # Deserializes the data based on type
157
+ # @param string type Data type
158
+ # @param string value Value to be deserialized
159
+ # @return [Object] Deserialized data
160
+ def self._deserialize(type, value)
161
+ case type.to_sym
162
+ when :Time
163
+ Time.parse(value)
164
+ when :Date
165
+ Date.parse(value)
166
+ when :String
167
+ value.to_s
168
+ when :Integer
169
+ value.to_i
170
+ when :Float
171
+ value.to_f
172
+ when :Boolean
173
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
174
+ true
175
+ else
176
+ false
177
+ end
178
+ when :Object
179
+ # generic object (usually a Hash), return directly
180
+ value
181
+ when /\AArray<(?<inner_type>.+)>\z/
182
+ inner_type = Regexp.last_match[:inner_type]
183
+ value.map { |v| _deserialize(inner_type, v) }
184
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
185
+ k_type = Regexp.last_match[:k_type]
186
+ v_type = Regexp.last_match[:v_type]
187
+ {}.tap do |hash|
188
+ value.each do |k, v|
189
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
190
+ end
191
+ end
192
+ else # model
193
+ # models (e.g. Pet) or oneOf
194
+ klass = Onfido.const_get(type)
195
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
196
+ end
197
+ end
198
+
199
+ # Returns the string representation of the object
200
+ # @return [String] String presentation of the object
201
+ def to_s
202
+ to_hash.to_s
203
+ end
204
+
205
+ # to_body is an alias to to_hash (backward compatibility)
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_body
208
+ to_hash
209
+ end
210
+
211
+ # Returns the object in the form of hash
212
+ # @return [Hash] Returns the object in the form of hash
213
+ def to_hash
214
+ hash = {}
215
+ self.class.attribute_map.each_pair do |attr, param|
216
+ value = self.send(attr)
217
+ if value.nil?
218
+ is_nullable = self.class.openapi_nullable.include?(attr)
219
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
220
+ end
221
+
222
+ hash[param] = _to_hash(value)
223
+ end
224
+ hash
225
+ end
226
+
227
+ # Outputs non-array value in the form of hash
228
+ # For object, use to_hash. Otherwise, just return the value
229
+ # @param [Object] value Any valid value
230
+ # @return [Hash] Returns the value in the form of hash
231
+ def _to_hash(value)
232
+ if value.is_a?(Array)
233
+ value.compact.map { |v| _to_hash(v) }
234
+ elsif value.is_a?(Hash)
235
+ {}.tap do |hash|
236
+ value.each { |k, v| hash[k] = _to_hash(v) }
237
+ end
238
+ elsif value.respond_to? :to_hash
239
+ value.to_hash
240
+ else
241
+ value
242
+ end
243
+ end
244
+
245
+ end
246
+
247
+ end
@@ -0,0 +1,323 @@
1
+ =begin
2
+ #Onfido Public API v3.6
3
+
4
+ #The Onfido Public 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.16.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Onfido
17
+ class WatchlistMeshAlertRisk
18
+ # The date and time at which the risk record was created.
19
+ attr_accessor :created_at
20
+
21
+ # The review decision currently applied to the risk.
22
+ attr_accessor :decision
23
+
24
+ # The previous review decision, if one exists.
25
+ attr_accessor :previous_decision
26
+
27
+ # Additional details about the risk.
28
+ attr_accessor :detail
29
+
30
+ # The unique identifier of the risk record.
31
+ attr_accessor :identifier
32
+
33
+ # The type of risk returned for the alert.
34
+ attr_accessor :type
35
+
36
+ # The identifier of the user or system that last updated the risk decision.
37
+ attr_accessor :updated_by
38
+
39
+ # The date and time at which the risk record was last updated.
40
+ attr_accessor :updated_at
41
+
42
+ class EnumAttributeValidator
43
+ attr_reader :datatype
44
+ attr_reader :allowable_values
45
+
46
+ def initialize(datatype, allowable_values)
47
+ @allowable_values = allowable_values.map do |value|
48
+ case datatype.to_s
49
+ when /Integer/i
50
+ value.to_i
51
+ when /Float/i
52
+ value.to_f
53
+ else
54
+ value
55
+ end
56
+ end
57
+ end
58
+
59
+ def valid?(value)
60
+ !value || allowable_values.include?(value)
61
+ end
62
+ end
63
+
64
+ # Attribute mapping from ruby-style variable name to JSON key.
65
+ def self.attribute_map
66
+ {
67
+ :'created_at' => :'created_at',
68
+ :'decision' => :'decision',
69
+ :'previous_decision' => :'previous_decision',
70
+ :'detail' => :'detail',
71
+ :'identifier' => :'identifier',
72
+ :'type' => :'type',
73
+ :'updated_by' => :'updated_by',
74
+ :'updated_at' => :'updated_at'
75
+ }
76
+ end
77
+
78
+ # Returns attribute mapping this model knows about
79
+ def self.acceptable_attribute_map
80
+ attribute_map
81
+ end
82
+
83
+ # Returns all the JSON keys this model knows about
84
+ def self.acceptable_attributes
85
+ acceptable_attribute_map.values
86
+ end
87
+
88
+ # Attribute type mapping.
89
+ def self.openapi_types
90
+ {
91
+ :'created_at' => :'Time',
92
+ :'decision' => :'WatchlistMeshRiskDecision',
93
+ :'previous_decision' => :'WatchlistMeshRiskDecision',
94
+ :'detail' => :'WatchlistMeshRiskDetail',
95
+ :'identifier' => :'String',
96
+ :'type' => :'String',
97
+ :'updated_by' => :'String',
98
+ :'updated_at' => :'Time'
99
+ }
100
+ end
101
+
102
+ # List of attributes with nullable: true
103
+ def self.openapi_nullable
104
+ Set.new([
105
+ :'previous_decision',
106
+ :'updated_by',
107
+ :'updated_at'
108
+ ])
109
+ end
110
+
111
+ # List of class defined in allOf (OpenAPI v3)
112
+ def self.openapi_all_of
113
+ [
114
+ :'WatchlistMeshAlertRisk1'
115
+ ]
116
+ end
117
+
118
+ # Initializes the object
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ def initialize(attributes = {})
121
+ if (!attributes.is_a?(Hash))
122
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistMeshAlertRisk` initialize method"
123
+ end
124
+
125
+ # check to see if the attribute exists and convert string to symbol for hash key
126
+ acceptable_attribute_map = self.class.acceptable_attribute_map
127
+ attributes = attributes.each_with_object({}) { |(k, v), h|
128
+ if (!acceptable_attribute_map.key?(k.to_sym))
129
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistMeshAlertRisk`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
130
+ end
131
+ h[k.to_sym] = v
132
+ }
133
+
134
+ if attributes.key?(:'created_at')
135
+ self.created_at = attributes[:'created_at']
136
+ end
137
+
138
+ if attributes.key?(:'decision')
139
+ self.decision = attributes[:'decision']
140
+ end
141
+
142
+ if attributes.key?(:'previous_decision')
143
+ self.previous_decision = attributes[:'previous_decision']
144
+ end
145
+
146
+ if attributes.key?(:'detail')
147
+ self.detail = attributes[:'detail']
148
+ end
149
+
150
+ if attributes.key?(:'identifier')
151
+ self.identifier = attributes[:'identifier']
152
+ end
153
+
154
+ if attributes.key?(:'type')
155
+ self.type = attributes[:'type']
156
+ end
157
+
158
+ if attributes.key?(:'updated_by')
159
+ self.updated_by = attributes[:'updated_by']
160
+ end
161
+
162
+ if attributes.key?(:'updated_at')
163
+ self.updated_at = attributes[:'updated_at']
164
+ end
165
+ end
166
+
167
+ # Show invalid properties with the reasons. Usually used together with valid?
168
+ # @return Array for valid properties with the reasons
169
+ def list_invalid_properties
170
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
171
+ invalid_properties = Array.new
172
+ invalid_properties
173
+ end
174
+
175
+ # Check to see if the all the properties in the model are valid
176
+ # @return true if the model is valid
177
+ def valid?
178
+ warn '[DEPRECATED] the `valid?` method is obsolete'
179
+ true
180
+ end
181
+
182
+ # Checks equality by comparing each attribute.
183
+ # @param [Object] Object to be compared
184
+ def ==(o)
185
+ return true if self.equal?(o)
186
+ self.class == o.class &&
187
+ created_at == o.created_at &&
188
+ decision == o.decision &&
189
+ previous_decision == o.previous_decision &&
190
+ detail == o.detail &&
191
+ identifier == o.identifier &&
192
+ type == o.type &&
193
+ updated_by == o.updated_by &&
194
+ updated_at == o.updated_at
195
+ end
196
+
197
+ # @see the `==` method
198
+ # @param [Object] Object to be compared
199
+ def eql?(o)
200
+ self == o
201
+ end
202
+
203
+ # Calculates hash code according to all attributes.
204
+ # @return [Integer] Hash code
205
+ def hash
206
+ [created_at, decision, previous_decision, detail, identifier, type, updated_by, updated_at].hash
207
+ end
208
+
209
+ # Builds the object from hash
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ # @return [Object] Returns the model itself
212
+ def self.build_from_hash(attributes)
213
+ return nil unless attributes.is_a?(Hash)
214
+ attributes = attributes.transform_keys(&:to_sym)
215
+ transformed_hash = {}
216
+ openapi_types.each_pair do |key, type|
217
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
218
+ transformed_hash["#{key}"] = nil
219
+ elsif type =~ /\AArray<(.*)>/i
220
+ # check to ensure the input is an array given that the attribute
221
+ # is documented as an array but the input is not
222
+ if attributes[attribute_map[key]].is_a?(Array)
223
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
224
+ end
225
+ elsif !attributes[attribute_map[key]].nil?
226
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
227
+ end
228
+ end
229
+ new(transformed_hash)
230
+ end
231
+
232
+ # Deserializes the data based on type
233
+ # @param string type Data type
234
+ # @param string value Value to be deserialized
235
+ # @return [Object] Deserialized data
236
+ def self._deserialize(type, value)
237
+ case type.to_sym
238
+ when :Time
239
+ Time.parse(value)
240
+ when :Date
241
+ Date.parse(value)
242
+ when :String
243
+ value.to_s
244
+ when :Integer
245
+ value.to_i
246
+ when :Float
247
+ value.to_f
248
+ when :Boolean
249
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
250
+ true
251
+ else
252
+ false
253
+ end
254
+ when :Object
255
+ # generic object (usually a Hash), return directly
256
+ value
257
+ when /\AArray<(?<inner_type>.+)>\z/
258
+ inner_type = Regexp.last_match[:inner_type]
259
+ value.map { |v| _deserialize(inner_type, v) }
260
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
261
+ k_type = Regexp.last_match[:k_type]
262
+ v_type = Regexp.last_match[:v_type]
263
+ {}.tap do |hash|
264
+ value.each do |k, v|
265
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
266
+ end
267
+ end
268
+ else # model
269
+ # models (e.g. Pet) or oneOf
270
+ klass = Onfido.const_get(type)
271
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
272
+ end
273
+ end
274
+
275
+ # Returns the string representation of the object
276
+ # @return [String] String presentation of the object
277
+ def to_s
278
+ to_hash.to_s
279
+ end
280
+
281
+ # to_body is an alias to to_hash (backward compatibility)
282
+ # @return [Hash] Returns the object in the form of hash
283
+ def to_body
284
+ to_hash
285
+ end
286
+
287
+ # Returns the object in the form of hash
288
+ # @return [Hash] Returns the object in the form of hash
289
+ def to_hash
290
+ hash = {}
291
+ self.class.attribute_map.each_pair do |attr, param|
292
+ value = self.send(attr)
293
+ if value.nil?
294
+ is_nullable = self.class.openapi_nullable.include?(attr)
295
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
296
+ end
297
+
298
+ hash[param] = _to_hash(value)
299
+ end
300
+ hash
301
+ end
302
+
303
+ # Outputs non-array value in the form of hash
304
+ # For object, use to_hash. Otherwise, just return the value
305
+ # @param [Object] value Any valid value
306
+ # @return [Hash] Returns the value in the form of hash
307
+ def _to_hash(value)
308
+ if value.is_a?(Array)
309
+ value.compact.map { |v| _to_hash(v) }
310
+ elsif value.is_a?(Hash)
311
+ {}.tap do |hash|
312
+ value.each { |k, v| hash[k] = _to_hash(v) }
313
+ end
314
+ elsif value.respond_to? :to_hash
315
+ value.to_hash
316
+ else
317
+ value
318
+ end
319
+ end
320
+
321
+ end
322
+
323
+ end