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,231 @@
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 WatchlistMeshImage
18
+ attr_accessor :source
19
+
20
+ attr_accessor :url
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+ :'source' => :'source',
26
+ :'url' => :'url'
27
+ }
28
+ end
29
+
30
+ # Returns attribute mapping this model knows about
31
+ def self.acceptable_attribute_map
32
+ attribute_map
33
+ end
34
+
35
+ # Returns all the JSON keys this model knows about
36
+ def self.acceptable_attributes
37
+ acceptable_attribute_map.values
38
+ end
39
+
40
+ # Attribute type mapping.
41
+ def self.openapi_types
42
+ {
43
+ :'source' => :'String',
44
+ :'url' => :'String'
45
+ }
46
+ end
47
+
48
+ # List of attributes with nullable: true
49
+ def self.openapi_nullable
50
+ Set.new([
51
+ :'source',
52
+ :'url'
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::WatchlistMeshImage` 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::WatchlistMeshImage`. 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?(:'source')
73
+ self.source = attributes[:'source']
74
+ end
75
+
76
+ if attributes.key?(:'url')
77
+ self.url = attributes[:'url']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
85
+ invalid_properties = Array.new
86
+ invalid_properties
87
+ end
88
+
89
+ # Check to see if the all the properties in the model are valid
90
+ # @return true if the model is valid
91
+ def valid?
92
+ warn '[DEPRECATED] the `valid?` method is obsolete'
93
+ true
94
+ end
95
+
96
+ # Checks equality by comparing each attribute.
97
+ # @param [Object] Object to be compared
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ source == o.source &&
102
+ url == o.url
103
+ end
104
+
105
+ # @see the `==` method
106
+ # @param [Object] Object to be compared
107
+ def eql?(o)
108
+ self == o
109
+ end
110
+
111
+ # Calculates hash code according to all attributes.
112
+ # @return [Integer] Hash code
113
+ def hash
114
+ [source, url].hash
115
+ end
116
+
117
+ # Builds the object from hash
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ # @return [Object] Returns the model itself
120
+ def self.build_from_hash(attributes)
121
+ return nil unless attributes.is_a?(Hash)
122
+ attributes = attributes.transform_keys(&:to_sym)
123
+ transformed_hash = {}
124
+ openapi_types.each_pair do |key, type|
125
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
126
+ transformed_hash["#{key}"] = nil
127
+ elsif type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[attribute_map[key]].is_a?(Array)
131
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
132
+ end
133
+ elsif !attributes[attribute_map[key]].nil?
134
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
135
+ end
136
+ end
137
+ new(transformed_hash)
138
+ end
139
+
140
+ # Deserializes the data based on type
141
+ # @param string type Data type
142
+ # @param string value Value to be deserialized
143
+ # @return [Object] Deserialized data
144
+ def self._deserialize(type, value)
145
+ case type.to_sym
146
+ when :Time
147
+ Time.parse(value)
148
+ when :Date
149
+ Date.parse(value)
150
+ when :String
151
+ value.to_s
152
+ when :Integer
153
+ value.to_i
154
+ when :Float
155
+ value.to_f
156
+ when :Boolean
157
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
+ true
159
+ else
160
+ false
161
+ end
162
+ when :Object
163
+ # generic object (usually a Hash), return directly
164
+ value
165
+ when /\AArray<(?<inner_type>.+)>\z/
166
+ inner_type = Regexp.last_match[:inner_type]
167
+ value.map { |v| _deserialize(inner_type, v) }
168
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
169
+ k_type = Regexp.last_match[:k_type]
170
+ v_type = Regexp.last_match[:v_type]
171
+ {}.tap do |hash|
172
+ value.each do |k, v|
173
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
174
+ end
175
+ end
176
+ else # model
177
+ # models (e.g. Pet) or oneOf
178
+ klass = Onfido.const_get(type)
179
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
180
+ end
181
+ end
182
+
183
+ # Returns the string representation of the object
184
+ # @return [String] String presentation of the object
185
+ def to_s
186
+ to_hash.to_s
187
+ end
188
+
189
+ # to_body is an alias to to_hash (backward compatibility)
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_body
192
+ to_hash
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ if value.nil?
202
+ is_nullable = self.class.openapi_nullable.include?(attr)
203
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
+ end
205
+
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+
211
+ # Outputs non-array value in the form of hash
212
+ # For object, use to_hash. Otherwise, just return the value
213
+ # @param [Object] value Any valid value
214
+ # @return [Hash] Returns the value in the form of hash
215
+ def _to_hash(value)
216
+ if value.is_a?(Array)
217
+ value.compact.map { |v| _to_hash(v) }
218
+ elsif value.is_a?(Hash)
219
+ {}.tap do |hash|
220
+ value.each { |k, v| hash[k] = _to_hash(v) }
221
+ end
222
+ elsif value.respond_to? :to_hash
223
+ value.to_hash
224
+ else
225
+ value
226
+ end
227
+ end
228
+
229
+ end
230
+
231
+ end
@@ -0,0 +1,309 @@
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 WatchlistMeshLists
18
+ attr_accessor :aml_types
19
+
20
+ attr_accessor :country_codes
21
+
22
+ attr_accessor :fields
23
+
24
+ attr_accessor :identifier
25
+
26
+ attr_accessor :listing_ended_utc
27
+
28
+ attr_accessor :listing_started_utc
29
+
30
+ attr_accessor :name
31
+
32
+ attr_accessor :related_urls
33
+
34
+ attr_accessor :url
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'aml_types' => :'aml_types',
40
+ :'country_codes' => :'country_codes',
41
+ :'fields' => :'fields',
42
+ :'identifier' => :'identifier',
43
+ :'listing_ended_utc' => :'listing_ended_utc',
44
+ :'listing_started_utc' => :'listing_started_utc',
45
+ :'name' => :'name',
46
+ :'related_urls' => :'related_urls',
47
+ :'url' => :'url'
48
+ }
49
+ end
50
+
51
+ # Returns attribute mapping this model knows about
52
+ def self.acceptable_attribute_map
53
+ attribute_map
54
+ end
55
+
56
+ # Returns all the JSON keys this model knows about
57
+ def self.acceptable_attributes
58
+ acceptable_attribute_map.values
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.openapi_types
63
+ {
64
+ :'aml_types' => :'Array<String>',
65
+ :'country_codes' => :'Array<String>',
66
+ :'fields' => :'Array<WatchlistMeshField>',
67
+ :'identifier' => :'String',
68
+ :'listing_ended_utc' => :'String',
69
+ :'listing_started_utc' => :'String',
70
+ :'name' => :'String',
71
+ :'related_urls' => :'Array<String>',
72
+ :'url' => :'String'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ :'aml_types',
80
+ :'country_codes',
81
+ :'fields',
82
+ :'identifier',
83
+ :'listing_ended_utc',
84
+ :'listing_started_utc',
85
+ :'name',
86
+ :'related_urls',
87
+ :'url'
88
+ ])
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ def initialize(attributes = {})
94
+ if (!attributes.is_a?(Hash))
95
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Onfido::WatchlistMeshLists` initialize method"
96
+ end
97
+
98
+ # check to see if the attribute exists and convert string to symbol for hash key
99
+ acceptable_attribute_map = self.class.acceptable_attribute_map
100
+ attributes = attributes.each_with_object({}) { |(k, v), h|
101
+ if (!acceptable_attribute_map.key?(k.to_sym))
102
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Onfido::WatchlistMeshLists`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
103
+ end
104
+ h[k.to_sym] = v
105
+ }
106
+
107
+ if attributes.key?(:'aml_types')
108
+ if (value = attributes[:'aml_types']).is_a?(Array)
109
+ self.aml_types = value
110
+ end
111
+ end
112
+
113
+ if attributes.key?(:'country_codes')
114
+ if (value = attributes[:'country_codes']).is_a?(Array)
115
+ self.country_codes = value
116
+ end
117
+ end
118
+
119
+ if attributes.key?(:'fields')
120
+ if (value = attributes[:'fields']).is_a?(Array)
121
+ self.fields = value
122
+ end
123
+ end
124
+
125
+ if attributes.key?(:'identifier')
126
+ self.identifier = attributes[:'identifier']
127
+ end
128
+
129
+ if attributes.key?(:'listing_ended_utc')
130
+ self.listing_ended_utc = attributes[:'listing_ended_utc']
131
+ end
132
+
133
+ if attributes.key?(:'listing_started_utc')
134
+ self.listing_started_utc = attributes[:'listing_started_utc']
135
+ end
136
+
137
+ if attributes.key?(:'name')
138
+ self.name = attributes[:'name']
139
+ end
140
+
141
+ if attributes.key?(:'related_urls')
142
+ if (value = attributes[:'related_urls']).is_a?(Array)
143
+ self.related_urls = value
144
+ end
145
+ end
146
+
147
+ if attributes.key?(:'url')
148
+ self.url = attributes[:'url']
149
+ end
150
+ end
151
+
152
+ # Show invalid properties with the reasons. Usually used together with valid?
153
+ # @return Array for valid properties with the reasons
154
+ def list_invalid_properties
155
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
156
+ invalid_properties = Array.new
157
+ invalid_properties
158
+ end
159
+
160
+ # Check to see if the all the properties in the model are valid
161
+ # @return true if the model is valid
162
+ def valid?
163
+ warn '[DEPRECATED] the `valid?` method is obsolete'
164
+ true
165
+ end
166
+
167
+ # Checks equality by comparing each attribute.
168
+ # @param [Object] Object to be compared
169
+ def ==(o)
170
+ return true if self.equal?(o)
171
+ self.class == o.class &&
172
+ aml_types == o.aml_types &&
173
+ country_codes == o.country_codes &&
174
+ fields == o.fields &&
175
+ identifier == o.identifier &&
176
+ listing_ended_utc == o.listing_ended_utc &&
177
+ listing_started_utc == o.listing_started_utc &&
178
+ name == o.name &&
179
+ related_urls == o.related_urls &&
180
+ url == o.url
181
+ end
182
+
183
+ # @see the `==` method
184
+ # @param [Object] Object to be compared
185
+ def eql?(o)
186
+ self == o
187
+ end
188
+
189
+ # Calculates hash code according to all attributes.
190
+ # @return [Integer] Hash code
191
+ def hash
192
+ [aml_types, country_codes, fields, identifier, listing_ended_utc, listing_started_utc, name, related_urls, url].hash
193
+ end
194
+
195
+ # Builds the object from hash
196
+ # @param [Hash] attributes Model attributes in the form of hash
197
+ # @return [Object] Returns the model itself
198
+ def self.build_from_hash(attributes)
199
+ return nil unless attributes.is_a?(Hash)
200
+ attributes = attributes.transform_keys(&:to_sym)
201
+ transformed_hash = {}
202
+ openapi_types.each_pair do |key, type|
203
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
204
+ transformed_hash["#{key}"] = nil
205
+ elsif type =~ /\AArray<(.*)>/i
206
+ # check to ensure the input is an array given that the attribute
207
+ # is documented as an array but the input is not
208
+ if attributes[attribute_map[key]].is_a?(Array)
209
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
210
+ end
211
+ elsif !attributes[attribute_map[key]].nil?
212
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
213
+ end
214
+ end
215
+ new(transformed_hash)
216
+ end
217
+
218
+ # Deserializes the data based on type
219
+ # @param string type Data type
220
+ # @param string value Value to be deserialized
221
+ # @return [Object] Deserialized data
222
+ def self._deserialize(type, value)
223
+ case type.to_sym
224
+ when :Time
225
+ Time.parse(value)
226
+ when :Date
227
+ Date.parse(value)
228
+ when :String
229
+ value.to_s
230
+ when :Integer
231
+ value.to_i
232
+ when :Float
233
+ value.to_f
234
+ when :Boolean
235
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
236
+ true
237
+ else
238
+ false
239
+ end
240
+ when :Object
241
+ # generic object (usually a Hash), return directly
242
+ value
243
+ when /\AArray<(?<inner_type>.+)>\z/
244
+ inner_type = Regexp.last_match[:inner_type]
245
+ value.map { |v| _deserialize(inner_type, v) }
246
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
247
+ k_type = Regexp.last_match[:k_type]
248
+ v_type = Regexp.last_match[:v_type]
249
+ {}.tap do |hash|
250
+ value.each do |k, v|
251
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
252
+ end
253
+ end
254
+ else # model
255
+ # models (e.g. Pet) or oneOf
256
+ klass = Onfido.const_get(type)
257
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
258
+ end
259
+ end
260
+
261
+ # Returns the string representation of the object
262
+ # @return [String] String presentation of the object
263
+ def to_s
264
+ to_hash.to_s
265
+ end
266
+
267
+ # to_body is an alias to to_hash (backward compatibility)
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_body
270
+ to_hash
271
+ end
272
+
273
+ # Returns the object in the form of hash
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_hash
276
+ hash = {}
277
+ self.class.attribute_map.each_pair do |attr, param|
278
+ value = self.send(attr)
279
+ if value.nil?
280
+ is_nullable = self.class.openapi_nullable.include?(attr)
281
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
282
+ end
283
+
284
+ hash[param] = _to_hash(value)
285
+ end
286
+ hash
287
+ end
288
+
289
+ # Outputs non-array value in the form of hash
290
+ # For object, use to_hash. Otherwise, just return the value
291
+ # @param [Object] value Any valid value
292
+ # @return [Hash] Returns the value in the form of hash
293
+ def _to_hash(value)
294
+ if value.is_a?(Array)
295
+ value.compact.map { |v| _to_hash(v) }
296
+ elsif value.is_a?(Hash)
297
+ {}.tap do |hash|
298
+ value.each { |k, v| hash[k] = _to_hash(v) }
299
+ end
300
+ elsif value.respond_to? :to_hash
301
+ value.to_hash
302
+ else
303
+ value
304
+ end
305
+ end
306
+
307
+ end
308
+
309
+ end