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