trulioo_sdk 1.0.3

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 (92) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +155 -0
  3. data/docs/Address.md +44 -0
  4. data/docs/AppendedField.md +20 -0
  5. data/docs/Business.md +36 -0
  6. data/docs/BusinessApi.md +155 -0
  7. data/docs/BusinessRecord.md +24 -0
  8. data/docs/BusinessRegistrationNumber.md +30 -0
  9. data/docs/BusinessRegistrationNumberMask.md +22 -0
  10. data/docs/BusinessResult.md +22 -0
  11. data/docs/BusinessSearchRequest.md +28 -0
  12. data/docs/BusinessSearchRequestBusinessSearchModel.md +26 -0
  13. data/docs/BusinessSearchResponse.md +28 -0
  14. data/docs/BusinessSearchResponseIndustryCode.md +20 -0
  15. data/docs/Communication.md +24 -0
  16. data/docs/ConfigurationApi.md +761 -0
  17. data/docs/ConnectionApi.md +213 -0
  18. data/docs/Consent.md +22 -0
  19. data/docs/CountrySubdivision.md +22 -0
  20. data/docs/DataField.md +22 -0
  21. data/docs/DataFields.md +34 -0
  22. data/docs/DatasourceField.md +24 -0
  23. data/docs/DatasourceResult.md +28 -0
  24. data/docs/Document.md +28 -0
  25. data/docs/DriverLicence.md +26 -0
  26. data/docs/Location.md +42 -0
  27. data/docs/LocationAdditionalFields.md +18 -0
  28. data/docs/NationalId.md +28 -0
  29. data/docs/NormalizedDatasourceField.md +20 -0
  30. data/docs/NormalizedDatasourceGroupCountry.md +34 -0
  31. data/docs/Passport.md +28 -0
  32. data/docs/PersonInfo.md +38 -0
  33. data/docs/PersonInfoAdditionalFields.md +18 -0
  34. data/docs/Record.md +26 -0
  35. data/docs/RecordRule.md +20 -0
  36. data/docs/Result.md +62 -0
  37. data/docs/ServiceError.md +20 -0
  38. data/docs/TestEntityDataFields.md +36 -0
  39. data/docs/TransactionRecordResult.md +32 -0
  40. data/docs/TransactionRecordResultAllOf.md +18 -0
  41. data/docs/TransactionStatus.md +26 -0
  42. data/docs/VerificationsApi.md +529 -0
  43. data/docs/VerifyRequest.md +38 -0
  44. data/docs/VerifyResult.md +30 -0
  45. data/lib/trulioo_sdk.rb +77 -0
  46. data/lib/trulioo_sdk/api/business_api.rb +158 -0
  47. data/lib/trulioo_sdk/api/configuration_api.rb +750 -0
  48. data/lib/trulioo_sdk/api/connection_api.rb +221 -0
  49. data/lib/trulioo_sdk/api/verifications_api.rb +515 -0
  50. data/lib/trulioo_sdk/api_client.rb +391 -0
  51. data/lib/trulioo_sdk/api_error.rb +53 -0
  52. data/lib/trulioo_sdk/configuration.rb +268 -0
  53. data/lib/trulioo_sdk/models/address.rb +356 -0
  54. data/lib/trulioo_sdk/models/appended_field.rb +237 -0
  55. data/lib/trulioo_sdk/models/business.rb +318 -0
  56. data/lib/trulioo_sdk/models/business_record.rb +261 -0
  57. data/lib/trulioo_sdk/models/business_registration_number.rb +410 -0
  58. data/lib/trulioo_sdk/models/business_registration_number_mask.rb +272 -0
  59. data/lib/trulioo_sdk/models/business_result.rb +249 -0
  60. data/lib/trulioo_sdk/models/business_search_request.rb +306 -0
  61. data/lib/trulioo_sdk/models/business_search_request_business_search_model.rb +364 -0
  62. data/lib/trulioo_sdk/models/business_search_response.rb +279 -0
  63. data/lib/trulioo_sdk/models/business_search_response_industry_code.rb +236 -0
  64. data/lib/trulioo_sdk/models/communication.rb +354 -0
  65. data/lib/trulioo_sdk/models/consent.rb +249 -0
  66. data/lib/trulioo_sdk/models/country_subdivision.rb +320 -0
  67. data/lib/trulioo_sdk/models/data_field.rb +245 -0
  68. data/lib/trulioo_sdk/models/data_fields.rb +306 -0
  69. data/lib/trulioo_sdk/models/datasource_field.rb +254 -0
  70. data/lib/trulioo_sdk/models/datasource_result.rb +281 -0
  71. data/lib/trulioo_sdk/models/document.rb +278 -0
  72. data/lib/trulioo_sdk/models/driver_licence.rb +268 -0
  73. data/lib/trulioo_sdk/models/location.rb +347 -0
  74. data/lib/trulioo_sdk/models/location_additional_fields.rb +229 -0
  75. data/lib/trulioo_sdk/models/national_id.rb +277 -0
  76. data/lib/trulioo_sdk/models/normalized_datasource_field.rb +286 -0
  77. data/lib/trulioo_sdk/models/normalized_datasource_group_country.rb +437 -0
  78. data/lib/trulioo_sdk/models/passport.rb +326 -0
  79. data/lib/trulioo_sdk/models/person_info.rb +448 -0
  80. data/lib/trulioo_sdk/models/person_info_additional_fields.rb +228 -0
  81. data/lib/trulioo_sdk/models/record.rb +270 -0
  82. data/lib/trulioo_sdk/models/record_rule.rb +239 -0
  83. data/lib/trulioo_sdk/models/result.rb +440 -0
  84. data/lib/trulioo_sdk/models/service_error.rb +236 -0
  85. data/lib/trulioo_sdk/models/test_entity_data_fields.rb +315 -0
  86. data/lib/trulioo_sdk/models/transaction_record_result.rb +307 -0
  87. data/lib/trulioo_sdk/models/transaction_record_result_all_of.rb +229 -0
  88. data/lib/trulioo_sdk/models/transaction_status.rb +341 -0
  89. data/lib/trulioo_sdk/models/verify_request.rb +410 -0
  90. data/lib/trulioo_sdk/models/verify_result.rb +288 -0
  91. data/lib/trulioo_sdk/version.rb +11 -0
  92. metadata +223 -0
@@ -0,0 +1,437 @@
1
+ =begin
2
+ Trulioo Ruby SDK
3
+
4
+ Gem version: 1.0.3
5
+ Trulioo OpenAPI version: v1
6
+ Generated by OpenAPI Generator version: 5.0.1
7
+ =end
8
+
9
+ require 'date'
10
+ require 'time'
11
+
12
+ module Trulioo
13
+ # Datasource group config for country
14
+ class NormalizedDatasourceGroupCountry
15
+ # Name
16
+ attr_accessor :name
17
+
18
+ # Description
19
+ attr_accessor :description
20
+
21
+ # Required Fields
22
+ attr_accessor :required_fields
23
+
24
+ # Optional Fields
25
+ attr_accessor :optional_fields
26
+
27
+ # Appended Fields
28
+ attr_accessor :appended_fields
29
+
30
+ # Output Fields
31
+ attr_accessor :output_fields
32
+
33
+ # Source Type
34
+ attr_accessor :source_type
35
+
36
+ # Update Frequency
37
+ attr_accessor :update_frequency
38
+
39
+ # Coverage
40
+ attr_accessor :coverage
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'name' => :'Name',
46
+ :'description' => :'Description',
47
+ :'required_fields' => :'RequiredFields',
48
+ :'optional_fields' => :'OptionalFields',
49
+ :'appended_fields' => :'AppendedFields',
50
+ :'output_fields' => :'OutputFields',
51
+ :'source_type' => :'SourceType',
52
+ :'update_frequency' => :'UpdateFrequency',
53
+ :'coverage' => :'Coverage'
54
+ }
55
+ end
56
+
57
+ # Returns all the JSON keys this model knows about
58
+ def self.acceptable_attributes
59
+ attribute_map.values
60
+ end
61
+
62
+ # Attribute type mapping.
63
+ def self.openapi_types
64
+ {
65
+ :'name' => :'String',
66
+ :'description' => :'String',
67
+ :'required_fields' => :'Array<NormalizedDatasourceField>',
68
+ :'optional_fields' => :'Array<NormalizedDatasourceField>',
69
+ :'appended_fields' => :'Array<NormalizedDatasourceField>',
70
+ :'output_fields' => :'Array<NormalizedDatasourceField>',
71
+ :'source_type' => :'String',
72
+ :'update_frequency' => :'String',
73
+ :'coverage' => :'String'
74
+ }
75
+ end
76
+
77
+ # List of attributes with nullable: true
78
+ def self.openapi_nullable
79
+ Set.new([
80
+ ])
81
+ end
82
+
83
+ # Initializes the object
84
+ # @param [Hash] attributes Model attributes in the form of hash
85
+ def initialize(attributes = {})
86
+ if (!attributes.is_a?(Hash))
87
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Trulioo::NormalizedDatasourceGroupCountry` initialize method"
88
+ end
89
+
90
+ # check to see if the attribute exists and convert string to symbol for hash key
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!self.class.attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Trulioo::NormalizedDatasourceGroupCountry`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'name')
99
+ self.name = attributes[:'name']
100
+ end
101
+
102
+ if attributes.key?(:'description')
103
+ self.description = attributes[:'description']
104
+ end
105
+
106
+ if attributes.key?(:'required_fields')
107
+ if (value = attributes[:'required_fields']).is_a?(Array)
108
+ self.required_fields = value
109
+ end
110
+ end
111
+
112
+ if attributes.key?(:'optional_fields')
113
+ if (value = attributes[:'optional_fields']).is_a?(Array)
114
+ self.optional_fields = value
115
+ end
116
+ end
117
+
118
+ if attributes.key?(:'appended_fields')
119
+ if (value = attributes[:'appended_fields']).is_a?(Array)
120
+ self.appended_fields = value
121
+ end
122
+ end
123
+
124
+ if attributes.key?(:'output_fields')
125
+ if (value = attributes[:'output_fields']).is_a?(Array)
126
+ self.output_fields = value
127
+ end
128
+ end
129
+
130
+ if attributes.key?(:'source_type')
131
+ self.source_type = attributes[:'source_type']
132
+ end
133
+
134
+ if attributes.key?(:'update_frequency')
135
+ self.update_frequency = attributes[:'update_frequency']
136
+ end
137
+
138
+ if attributes.key?(:'coverage')
139
+ self.coverage = attributes[:'coverage']
140
+ end
141
+ end
142
+
143
+ # Show invalid properties with the reasons. Usually used together with valid?
144
+ # @return Array for valid properties with the reasons
145
+ def list_invalid_properties
146
+ invalid_properties = Array.new
147
+ if !@name.nil? && @name.to_s.length > 200
148
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 200.')
149
+ end
150
+
151
+ if !@name.nil? && @name.to_s.length < 0
152
+ invalid_properties.push('invalid value for "name", the character length must be great than or equal to 0.')
153
+ end
154
+
155
+ if !@description.nil? && @description.to_s.length > 500
156
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 500.')
157
+ end
158
+
159
+ if !@description.nil? && @description.to_s.length < 0
160
+ invalid_properties.push('invalid value for "description", the character length must be great than or equal to 0.')
161
+ end
162
+
163
+ if !@source_type.nil? && @source_type.to_s.length > 250
164
+ invalid_properties.push('invalid value for "source_type", the character length must be smaller than or equal to 250.')
165
+ end
166
+
167
+ if !@source_type.nil? && @source_type.to_s.length < 0
168
+ invalid_properties.push('invalid value for "source_type", the character length must be great than or equal to 0.')
169
+ end
170
+
171
+ if !@update_frequency.nil? && @update_frequency.to_s.length > 64
172
+ invalid_properties.push('invalid value for "update_frequency", the character length must be smaller than or equal to 64.')
173
+ end
174
+
175
+ if !@update_frequency.nil? && @update_frequency.to_s.length < 0
176
+ invalid_properties.push('invalid value for "update_frequency", the character length must be great than or equal to 0.')
177
+ end
178
+
179
+ if !@coverage.nil? && @coverage.to_s.length > 64
180
+ invalid_properties.push('invalid value for "coverage", the character length must be smaller than or equal to 64.')
181
+ end
182
+
183
+ if !@coverage.nil? && @coverage.to_s.length < 0
184
+ invalid_properties.push('invalid value for "coverage", the character length must be great than or equal to 0.')
185
+ end
186
+
187
+ invalid_properties
188
+ end
189
+
190
+ # Check to see if the all the properties in the model are valid
191
+ # @return true if the model is valid
192
+ def valid?
193
+ return false if !@name.nil? && @name.to_s.length > 200
194
+ return false if !@name.nil? && @name.to_s.length < 0
195
+ return false if !@description.nil? && @description.to_s.length > 500
196
+ return false if !@description.nil? && @description.to_s.length < 0
197
+ return false if !@source_type.nil? && @source_type.to_s.length > 250
198
+ return false if !@source_type.nil? && @source_type.to_s.length < 0
199
+ return false if !@update_frequency.nil? && @update_frequency.to_s.length > 64
200
+ return false if !@update_frequency.nil? && @update_frequency.to_s.length < 0
201
+ return false if !@coverage.nil? && @coverage.to_s.length > 64
202
+ return false if !@coverage.nil? && @coverage.to_s.length < 0
203
+ true
204
+ end
205
+
206
+ # Custom attribute writer method with validation
207
+ # @param [Object] name Value to be assigned
208
+ def name=(name)
209
+ if !name.nil? && name.to_s.length > 200
210
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 200.'
211
+ end
212
+
213
+ if !name.nil? && name.to_s.length < 0
214
+ fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 0.'
215
+ end
216
+
217
+ @name = name
218
+ end
219
+
220
+ # Custom attribute writer method with validation
221
+ # @param [Object] description Value to be assigned
222
+ def description=(description)
223
+ if !description.nil? && description.to_s.length > 500
224
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 500.'
225
+ end
226
+
227
+ if !description.nil? && description.to_s.length < 0
228
+ fail ArgumentError, 'invalid value for "description", the character length must be great than or equal to 0.'
229
+ end
230
+
231
+ @description = description
232
+ end
233
+
234
+ # Custom attribute writer method with validation
235
+ # @param [Object] source_type Value to be assigned
236
+ def source_type=(source_type)
237
+ if !source_type.nil? && source_type.to_s.length > 250
238
+ fail ArgumentError, 'invalid value for "source_type", the character length must be smaller than or equal to 250.'
239
+ end
240
+
241
+ if !source_type.nil? && source_type.to_s.length < 0
242
+ fail ArgumentError, 'invalid value for "source_type", the character length must be great than or equal to 0.'
243
+ end
244
+
245
+ @source_type = source_type
246
+ end
247
+
248
+ # Custom attribute writer method with validation
249
+ # @param [Object] update_frequency Value to be assigned
250
+ def update_frequency=(update_frequency)
251
+ if !update_frequency.nil? && update_frequency.to_s.length > 64
252
+ fail ArgumentError, 'invalid value for "update_frequency", the character length must be smaller than or equal to 64.'
253
+ end
254
+
255
+ if !update_frequency.nil? && update_frequency.to_s.length < 0
256
+ fail ArgumentError, 'invalid value for "update_frequency", the character length must be great than or equal to 0.'
257
+ end
258
+
259
+ @update_frequency = update_frequency
260
+ end
261
+
262
+ # Custom attribute writer method with validation
263
+ # @param [Object] coverage Value to be assigned
264
+ def coverage=(coverage)
265
+ if !coverage.nil? && coverage.to_s.length > 64
266
+ fail ArgumentError, 'invalid value for "coverage", the character length must be smaller than or equal to 64.'
267
+ end
268
+
269
+ if !coverage.nil? && coverage.to_s.length < 0
270
+ fail ArgumentError, 'invalid value for "coverage", the character length must be great than or equal to 0.'
271
+ end
272
+
273
+ @coverage = coverage
274
+ end
275
+
276
+ # Checks equality by comparing each attribute.
277
+ # @param [Object] Object to be compared
278
+ def ==(o)
279
+ return true if self.equal?(o)
280
+ self.class == o.class &&
281
+ name == o.name &&
282
+ description == o.description &&
283
+ required_fields == o.required_fields &&
284
+ optional_fields == o.optional_fields &&
285
+ appended_fields == o.appended_fields &&
286
+ output_fields == o.output_fields &&
287
+ source_type == o.source_type &&
288
+ update_frequency == o.update_frequency &&
289
+ coverage == o.coverage
290
+ end
291
+
292
+ # @see the `==` method
293
+ # @param [Object] Object to be compared
294
+ def eql?(o)
295
+ self == o
296
+ end
297
+
298
+ # Calculates hash code according to all attributes.
299
+ # @return [Integer] Hash code
300
+ def hash
301
+ [name, description, required_fields, optional_fields, appended_fields, output_fields, source_type, update_frequency, coverage].hash
302
+ end
303
+
304
+ # :nocov:
305
+ # Builds the object from hash
306
+ # @param [Hash] attributes Model attributes in the form of hash
307
+ # @return [Object] Returns the model itself
308
+ def self.build_from_hash(attributes)
309
+ new.build_from_hash(attributes)
310
+ end
311
+ # :nocov:
312
+
313
+ # :nocov:
314
+ # Builds the object from hash
315
+ # @param [Hash] attributes Model attributes in the form of hash
316
+ # @return [Object] Returns the model itself
317
+ def build_from_hash(attributes)
318
+ return nil unless attributes.is_a?(Hash)
319
+ self.class.openapi_types.each_pair do |key, type|
320
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
321
+ self.send("#{key}=", nil)
322
+ elsif type =~ /\AArray<(.*)>/i
323
+ # check to ensure the input is an array given that the attribute
324
+ # is documented as an array but the input is not
325
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
326
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
327
+ end
328
+ elsif !attributes[self.class.attribute_map[key]].nil?
329
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
330
+ end
331
+ end
332
+
333
+ self
334
+ end
335
+ # :nocov:
336
+
337
+ # :nocov:
338
+ # Deserializes the data based on type
339
+ # @param string type Data type
340
+ # @param string value Value to be deserialized
341
+ # @return [Object] Deserialized data
342
+ def _deserialize(type, value)
343
+ case type.to_sym
344
+ when :Time
345
+ Time.parse(value)
346
+ when :Date
347
+ Date.parse(value)
348
+ when :String
349
+ value.to_s
350
+ when :Integer
351
+ value.to_i
352
+ when :Float
353
+ value.to_f
354
+ when :Boolean
355
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
356
+ true
357
+ else
358
+ false
359
+ end
360
+ when :Object
361
+ # generic object (usually a Hash), return directly
362
+ value
363
+ when /\AArray<(?<inner_type>.+)>\z/
364
+ inner_type = Regexp.last_match[:inner_type]
365
+ value.map { |v| _deserialize(inner_type, v) }
366
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
367
+ k_type = Regexp.last_match[:k_type]
368
+ v_type = Regexp.last_match[:v_type]
369
+ {}.tap do |hash|
370
+ value.each do |k, v|
371
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
372
+ end
373
+ end
374
+ else # model
375
+ # models (e.g. Pet) or oneOf
376
+ klass = Trulioo.const_get(type)
377
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
378
+ end
379
+ end
380
+ # :nocov:
381
+
382
+ # :nocov:
383
+ # Returns the string representation of the object
384
+ # @return [String] String presentation of the object
385
+ def to_s
386
+ to_hash.to_s
387
+ end
388
+ # :nocov:
389
+
390
+ # :nocov:
391
+ # to_body is an alias to to_hash (backward compatibility)
392
+ # @return [Hash] Returns the object in the form of hash
393
+ def to_body
394
+ to_hash
395
+ end
396
+ # :nocov:
397
+
398
+ # :nocov:
399
+ # Returns the object in the form of hash
400
+ # @return [Hash] Returns the object in the form of hash
401
+ def to_hash
402
+ hash = {}
403
+ self.class.attribute_map.each_pair do |attr, param|
404
+ value = self.send(attr)
405
+ if value.nil?
406
+ is_nullable = self.class.openapi_nullable.include?(attr)
407
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
408
+ end
409
+
410
+ hash[param] = _to_hash(value)
411
+ end
412
+ hash
413
+ end
414
+ # :nocov:
415
+
416
+ # :nocov:
417
+ # Outputs non-array value in the form of hash
418
+ # For object, use to_hash. Otherwise, just return the value
419
+ # @param [Object] value Any valid value
420
+ # @return [Hash] Returns the value in the form of hash
421
+ def _to_hash(value)
422
+ if value.is_a?(Array)
423
+ value.compact.map { |v| _to_hash(v) }
424
+ elsif value.is_a?(Hash)
425
+ {}.tap do |hash|
426
+ value.each { |k, v| hash[k] = _to_hash(v) }
427
+ end
428
+ elsif value.respond_to? :to_hash
429
+ value.to_hash
430
+ else
431
+ value
432
+ end
433
+ end
434
+ # :nocov:
435
+ end
436
+
437
+ end
@@ -0,0 +1,326 @@
1
+ =begin
2
+ Trulioo Ruby SDK
3
+
4
+ Gem version: 1.0.3
5
+ Trulioo OpenAPI version: v1
6
+ Generated by OpenAPI Generator version: 5.0.1
7
+ =end
8
+
9
+ require 'date'
10
+ require 'time'
11
+
12
+ module Trulioo
13
+ class Passport
14
+ # Line 1 of the passport MRZ
15
+ attr_accessor :mrz1
16
+
17
+ # line 2 of the passport MRZ
18
+ attr_accessor :mrz2
19
+
20
+ # Passport Number
21
+ attr_accessor :number
22
+
23
+ # Passport's Licence day of expiry of the individual to be verified
24
+ attr_accessor :day_of_expiry
25
+
26
+ # Passport's Licence month of expiry of the individual to be verified
27
+ attr_accessor :month_of_expiry
28
+
29
+ # Passport's Licence year of expiry of the individual to be verified
30
+ attr_accessor :year_of_expiry
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'mrz1' => :'Mrz1',
36
+ :'mrz2' => :'Mrz2',
37
+ :'number' => :'Number',
38
+ :'day_of_expiry' => :'DayOfExpiry',
39
+ :'month_of_expiry' => :'MonthOfExpiry',
40
+ :'year_of_expiry' => :'YearOfExpiry'
41
+ }
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'mrz1' => :'String',
53
+ :'mrz2' => :'String',
54
+ :'number' => :'String',
55
+ :'day_of_expiry' => :'Integer',
56
+ :'month_of_expiry' => :'Integer',
57
+ :'year_of_expiry' => :'Integer'
58
+ }
59
+ end
60
+
61
+ # List of attributes with nullable: true
62
+ def self.openapi_nullable
63
+ Set.new([
64
+ ])
65
+ end
66
+
67
+ # Initializes the object
68
+ # @param [Hash] attributes Model attributes in the form of hash
69
+ def initialize(attributes = {})
70
+ if (!attributes.is_a?(Hash))
71
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Trulioo::Passport` initialize method"
72
+ end
73
+
74
+ # check to see if the attribute exists and convert string to symbol for hash key
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!self.class.attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Trulioo::Passport`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'mrz1')
83
+ self.mrz1 = attributes[:'mrz1']
84
+ end
85
+
86
+ if attributes.key?(:'mrz2')
87
+ self.mrz2 = attributes[:'mrz2']
88
+ end
89
+
90
+ if attributes.key?(:'number')
91
+ self.number = attributes[:'number']
92
+ end
93
+
94
+ if attributes.key?(:'day_of_expiry')
95
+ self.day_of_expiry = attributes[:'day_of_expiry']
96
+ end
97
+
98
+ if attributes.key?(:'month_of_expiry')
99
+ self.month_of_expiry = attributes[:'month_of_expiry']
100
+ end
101
+
102
+ if attributes.key?(:'year_of_expiry')
103
+ self.year_of_expiry = attributes[:'year_of_expiry']
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ invalid_properties = Array.new
111
+ if !@mrz1.nil? && @mrz1.to_s.length > 200
112
+ invalid_properties.push('invalid value for "mrz1", the character length must be smaller than or equal to 200.')
113
+ end
114
+
115
+ if !@mrz1.nil? && @mrz1.to_s.length < 0
116
+ invalid_properties.push('invalid value for "mrz1", the character length must be great than or equal to 0.')
117
+ end
118
+
119
+ if !@mrz2.nil? && @mrz2.to_s.length > 200
120
+ invalid_properties.push('invalid value for "mrz2", the character length must be smaller than or equal to 200.')
121
+ end
122
+
123
+ if !@mrz2.nil? && @mrz2.to_s.length < 0
124
+ invalid_properties.push('invalid value for "mrz2", the character length must be great than or equal to 0.')
125
+ end
126
+
127
+ invalid_properties
128
+ end
129
+
130
+ # Check to see if the all the properties in the model are valid
131
+ # @return true if the model is valid
132
+ def valid?
133
+ return false if !@mrz1.nil? && @mrz1.to_s.length > 200
134
+ return false if !@mrz1.nil? && @mrz1.to_s.length < 0
135
+ return false if !@mrz2.nil? && @mrz2.to_s.length > 200
136
+ return false if !@mrz2.nil? && @mrz2.to_s.length < 0
137
+ true
138
+ end
139
+
140
+ # Custom attribute writer method with validation
141
+ # @param [Object] mrz1 Value to be assigned
142
+ def mrz1=(mrz1)
143
+ if !mrz1.nil? && mrz1.to_s.length > 200
144
+ fail ArgumentError, 'invalid value for "mrz1", the character length must be smaller than or equal to 200.'
145
+ end
146
+
147
+ if !mrz1.nil? && mrz1.to_s.length < 0
148
+ fail ArgumentError, 'invalid value for "mrz1", the character length must be great than or equal to 0.'
149
+ end
150
+
151
+ @mrz1 = mrz1
152
+ end
153
+
154
+ # Custom attribute writer method with validation
155
+ # @param [Object] mrz2 Value to be assigned
156
+ def mrz2=(mrz2)
157
+ if !mrz2.nil? && mrz2.to_s.length > 200
158
+ fail ArgumentError, 'invalid value for "mrz2", the character length must be smaller than or equal to 200.'
159
+ end
160
+
161
+ if !mrz2.nil? && mrz2.to_s.length < 0
162
+ fail ArgumentError, 'invalid value for "mrz2", the character length must be great than or equal to 0.'
163
+ end
164
+
165
+ @mrz2 = mrz2
166
+ end
167
+
168
+ # Checks equality by comparing each attribute.
169
+ # @param [Object] Object to be compared
170
+ def ==(o)
171
+ return true if self.equal?(o)
172
+ self.class == o.class &&
173
+ mrz1 == o.mrz1 &&
174
+ mrz2 == o.mrz2 &&
175
+ number == o.number &&
176
+ day_of_expiry == o.day_of_expiry &&
177
+ month_of_expiry == o.month_of_expiry &&
178
+ year_of_expiry == o.year_of_expiry
179
+ end
180
+
181
+ # @see the `==` method
182
+ # @param [Object] Object to be compared
183
+ def eql?(o)
184
+ self == o
185
+ end
186
+
187
+ # Calculates hash code according to all attributes.
188
+ # @return [Integer] Hash code
189
+ def hash
190
+ [mrz1, mrz2, number, day_of_expiry, month_of_expiry, year_of_expiry].hash
191
+ end
192
+
193
+ # :nocov:
194
+ # Builds the object from hash
195
+ # @param [Hash] attributes Model attributes in the form of hash
196
+ # @return [Object] Returns the model itself
197
+ def self.build_from_hash(attributes)
198
+ new.build_from_hash(attributes)
199
+ end
200
+ # :nocov:
201
+
202
+ # :nocov:
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 build_from_hash(attributes)
207
+ return nil unless attributes.is_a?(Hash)
208
+ self.class.openapi_types.each_pair do |key, type|
209
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
210
+ self.send("#{key}=", nil)
211
+ elsif type =~ /\AArray<(.*)>/i
212
+ # check to ensure the input is an array given that the attribute
213
+ # is documented as an array but the input is not
214
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
215
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
216
+ end
217
+ elsif !attributes[self.class.attribute_map[key]].nil?
218
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
219
+ end
220
+ end
221
+
222
+ self
223
+ end
224
+ # :nocov:
225
+
226
+ # :nocov:
227
+ # Deserializes the data based on type
228
+ # @param string type Data type
229
+ # @param string value Value to be deserialized
230
+ # @return [Object] Deserialized data
231
+ def _deserialize(type, value)
232
+ case type.to_sym
233
+ when :Time
234
+ Time.parse(value)
235
+ when :Date
236
+ Date.parse(value)
237
+ when :String
238
+ value.to_s
239
+ when :Integer
240
+ value.to_i
241
+ when :Float
242
+ value.to_f
243
+ when :Boolean
244
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
245
+ true
246
+ else
247
+ false
248
+ end
249
+ when :Object
250
+ # generic object (usually a Hash), return directly
251
+ value
252
+ when /\AArray<(?<inner_type>.+)>\z/
253
+ inner_type = Regexp.last_match[:inner_type]
254
+ value.map { |v| _deserialize(inner_type, v) }
255
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
256
+ k_type = Regexp.last_match[:k_type]
257
+ v_type = Regexp.last_match[:v_type]
258
+ {}.tap do |hash|
259
+ value.each do |k, v|
260
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
261
+ end
262
+ end
263
+ else # model
264
+ # models (e.g. Pet) or oneOf
265
+ klass = Trulioo.const_get(type)
266
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
267
+ end
268
+ end
269
+ # :nocov:
270
+
271
+ # :nocov:
272
+ # Returns the string representation of the object
273
+ # @return [String] String presentation of the object
274
+ def to_s
275
+ to_hash.to_s
276
+ end
277
+ # :nocov:
278
+
279
+ # :nocov:
280
+ # to_body is an alias to to_hash (backward compatibility)
281
+ # @return [Hash] Returns the object in the form of hash
282
+ def to_body
283
+ to_hash
284
+ end
285
+ # :nocov:
286
+
287
+ # :nocov:
288
+ # Returns the object in the form of hash
289
+ # @return [Hash] Returns the object in the form of hash
290
+ def to_hash
291
+ hash = {}
292
+ self.class.attribute_map.each_pair do |attr, param|
293
+ value = self.send(attr)
294
+ if value.nil?
295
+ is_nullable = self.class.openapi_nullable.include?(attr)
296
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
297
+ end
298
+
299
+ hash[param] = _to_hash(value)
300
+ end
301
+ hash
302
+ end
303
+ # :nocov:
304
+
305
+ # :nocov:
306
+ # Outputs non-array value in the form of hash
307
+ # For object, use to_hash. Otherwise, just return the value
308
+ # @param [Object] value Any valid value
309
+ # @return [Hash] Returns the value in the form of hash
310
+ def _to_hash(value)
311
+ if value.is_a?(Array)
312
+ value.compact.map { |v| _to_hash(v) }
313
+ elsif value.is_a?(Hash)
314
+ {}.tap do |hash|
315
+ value.each { |k, v| hash[k] = _to_hash(v) }
316
+ end
317
+ elsif value.respond_to? :to_hash
318
+ value.to_hash
319
+ else
320
+ value
321
+ end
322
+ end
323
+ # :nocov:
324
+ end
325
+
326
+ end