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