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,440 @@
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 Result
14
+ attr_accessor :index
15
+
16
+ attr_accessor :business_name
17
+
18
+ attr_accessor :matching_score
19
+
20
+ attr_accessor :business_registration_number
21
+
22
+ attr_accessor :duns_number
23
+
24
+ attr_accessor :business_tax_id_number
25
+
26
+ attr_accessor :business_license_number
27
+
28
+ attr_accessor :jurisdiction_of_incorporation
29
+
30
+ attr_accessor :full_address
31
+
32
+ # Business Status
33
+ attr_accessor :business_status
34
+
35
+ # Trade Style Name
36
+ attr_accessor :trade_style_name
37
+
38
+ # Business Type
39
+ attr_accessor :business_type
40
+
41
+ attr_accessor :address
42
+
43
+ attr_accessor :other_business_names
44
+
45
+ attr_accessor :website
46
+
47
+ attr_accessor :telephone
48
+
49
+ attr_accessor :tax_id_number
50
+
51
+ attr_accessor :tax_id_numbers
52
+
53
+ attr_accessor :email_address
54
+
55
+ attr_accessor :web_domain
56
+
57
+ attr_accessor :web_domains
58
+
59
+ # North American Industry Classification System
60
+ attr_accessor :naics
61
+
62
+ # Standard Industrial Classification
63
+ attr_accessor :sic
64
+
65
+ # Attribute mapping from ruby-style variable name to JSON key.
66
+ def self.attribute_map
67
+ {
68
+ :'index' => :'Index',
69
+ :'business_name' => :'BusinessName',
70
+ :'matching_score' => :'MatchingScore',
71
+ :'business_registration_number' => :'BusinessRegistrationNumber',
72
+ :'duns_number' => :'DUNSNumber',
73
+ :'business_tax_id_number' => :'BusinessTaxIDNumber',
74
+ :'business_license_number' => :'BusinessLicenseNumber',
75
+ :'jurisdiction_of_incorporation' => :'JurisdictionOfIncorporation',
76
+ :'full_address' => :'FullAddress',
77
+ :'business_status' => :'BusinessStatus',
78
+ :'trade_style_name' => :'TradeStyleName',
79
+ :'business_type' => :'BusinessType',
80
+ :'address' => :'Address',
81
+ :'other_business_names' => :'OtherBusinessNames',
82
+ :'website' => :'Website',
83
+ :'telephone' => :'Telephone',
84
+ :'tax_id_number' => :'TaxIDNumber',
85
+ :'tax_id_numbers' => :'TaxIDNumbers',
86
+ :'email_address' => :'EmailAddress',
87
+ :'web_domain' => :'WebDomain',
88
+ :'web_domains' => :'WebDomains',
89
+ :'naics' => :'NAICS',
90
+ :'sic' => :'SIC'
91
+ }
92
+ end
93
+
94
+ # Returns all the JSON keys this model knows about
95
+ def self.acceptable_attributes
96
+ attribute_map.values
97
+ end
98
+
99
+ # Attribute type mapping.
100
+ def self.openapi_types
101
+ {
102
+ :'index' => :'String',
103
+ :'business_name' => :'String',
104
+ :'matching_score' => :'String',
105
+ :'business_registration_number' => :'String',
106
+ :'duns_number' => :'String',
107
+ :'business_tax_id_number' => :'String',
108
+ :'business_license_number' => :'String',
109
+ :'jurisdiction_of_incorporation' => :'String',
110
+ :'full_address' => :'String',
111
+ :'business_status' => :'String',
112
+ :'trade_style_name' => :'String',
113
+ :'business_type' => :'String',
114
+ :'address' => :'Address',
115
+ :'other_business_names' => :'Array<String>',
116
+ :'website' => :'String',
117
+ :'telephone' => :'String',
118
+ :'tax_id_number' => :'String',
119
+ :'tax_id_numbers' => :'Array<String>',
120
+ :'email_address' => :'String',
121
+ :'web_domain' => :'String',
122
+ :'web_domains' => :'Array<String>',
123
+ :'naics' => :'Array<BusinessSearchResponseIndustryCode>',
124
+ :'sic' => :'Array<BusinessSearchResponseIndustryCode>'
125
+ }
126
+ end
127
+
128
+ # List of attributes with nullable: true
129
+ def self.openapi_nullable
130
+ Set.new([
131
+ ])
132
+ end
133
+
134
+ # Initializes the object
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ def initialize(attributes = {})
137
+ if (!attributes.is_a?(Hash))
138
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Trulioo::Result` initialize method"
139
+ end
140
+
141
+ # check to see if the attribute exists and convert string to symbol for hash key
142
+ attributes = attributes.each_with_object({}) { |(k, v), h|
143
+ if (!self.class.attribute_map.key?(k.to_sym))
144
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Trulioo::Result`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
145
+ end
146
+ h[k.to_sym] = v
147
+ }
148
+
149
+ if attributes.key?(:'index')
150
+ self.index = attributes[:'index']
151
+ end
152
+
153
+ if attributes.key?(:'business_name')
154
+ self.business_name = attributes[:'business_name']
155
+ end
156
+
157
+ if attributes.key?(:'matching_score')
158
+ self.matching_score = attributes[:'matching_score']
159
+ end
160
+
161
+ if attributes.key?(:'business_registration_number')
162
+ self.business_registration_number = attributes[:'business_registration_number']
163
+ end
164
+
165
+ if attributes.key?(:'duns_number')
166
+ self.duns_number = attributes[:'duns_number']
167
+ end
168
+
169
+ if attributes.key?(:'business_tax_id_number')
170
+ self.business_tax_id_number = attributes[:'business_tax_id_number']
171
+ end
172
+
173
+ if attributes.key?(:'business_license_number')
174
+ self.business_license_number = attributes[:'business_license_number']
175
+ end
176
+
177
+ if attributes.key?(:'jurisdiction_of_incorporation')
178
+ self.jurisdiction_of_incorporation = attributes[:'jurisdiction_of_incorporation']
179
+ end
180
+
181
+ if attributes.key?(:'full_address')
182
+ self.full_address = attributes[:'full_address']
183
+ end
184
+
185
+ if attributes.key?(:'business_status')
186
+ self.business_status = attributes[:'business_status']
187
+ end
188
+
189
+ if attributes.key?(:'trade_style_name')
190
+ self.trade_style_name = attributes[:'trade_style_name']
191
+ end
192
+
193
+ if attributes.key?(:'business_type')
194
+ self.business_type = attributes[:'business_type']
195
+ end
196
+
197
+ if attributes.key?(:'address')
198
+ self.address = attributes[:'address']
199
+ end
200
+
201
+ if attributes.key?(:'other_business_names')
202
+ if (value = attributes[:'other_business_names']).is_a?(Array)
203
+ self.other_business_names = value
204
+ end
205
+ end
206
+
207
+ if attributes.key?(:'website')
208
+ self.website = attributes[:'website']
209
+ end
210
+
211
+ if attributes.key?(:'telephone')
212
+ self.telephone = attributes[:'telephone']
213
+ end
214
+
215
+ if attributes.key?(:'tax_id_number')
216
+ self.tax_id_number = attributes[:'tax_id_number']
217
+ end
218
+
219
+ if attributes.key?(:'tax_id_numbers')
220
+ if (value = attributes[:'tax_id_numbers']).is_a?(Array)
221
+ self.tax_id_numbers = value
222
+ end
223
+ end
224
+
225
+ if attributes.key?(:'email_address')
226
+ self.email_address = attributes[:'email_address']
227
+ end
228
+
229
+ if attributes.key?(:'web_domain')
230
+ self.web_domain = attributes[:'web_domain']
231
+ end
232
+
233
+ if attributes.key?(:'web_domains')
234
+ if (value = attributes[:'web_domains']).is_a?(Array)
235
+ self.web_domains = value
236
+ end
237
+ end
238
+
239
+ if attributes.key?(:'naics')
240
+ if (value = attributes[:'naics']).is_a?(Array)
241
+ self.naics = value
242
+ end
243
+ end
244
+
245
+ if attributes.key?(:'sic')
246
+ if (value = attributes[:'sic']).is_a?(Array)
247
+ self.sic = value
248
+ end
249
+ end
250
+ end
251
+
252
+ # Show invalid properties with the reasons. Usually used together with valid?
253
+ # @return Array for valid properties with the reasons
254
+ def list_invalid_properties
255
+ invalid_properties = Array.new
256
+ invalid_properties
257
+ end
258
+
259
+ # Check to see if the all the properties in the model are valid
260
+ # @return true if the model is valid
261
+ def valid?
262
+ true
263
+ end
264
+
265
+ # Checks equality by comparing each attribute.
266
+ # @param [Object] Object to be compared
267
+ def ==(o)
268
+ return true if self.equal?(o)
269
+ self.class == o.class &&
270
+ index == o.index &&
271
+ business_name == o.business_name &&
272
+ matching_score == o.matching_score &&
273
+ business_registration_number == o.business_registration_number &&
274
+ duns_number == o.duns_number &&
275
+ business_tax_id_number == o.business_tax_id_number &&
276
+ business_license_number == o.business_license_number &&
277
+ jurisdiction_of_incorporation == o.jurisdiction_of_incorporation &&
278
+ full_address == o.full_address &&
279
+ business_status == o.business_status &&
280
+ trade_style_name == o.trade_style_name &&
281
+ business_type == o.business_type &&
282
+ address == o.address &&
283
+ other_business_names == o.other_business_names &&
284
+ website == o.website &&
285
+ telephone == o.telephone &&
286
+ tax_id_number == o.tax_id_number &&
287
+ tax_id_numbers == o.tax_id_numbers &&
288
+ email_address == o.email_address &&
289
+ web_domain == o.web_domain &&
290
+ web_domains == o.web_domains &&
291
+ naics == o.naics &&
292
+ sic == o.sic
293
+ end
294
+
295
+ # @see the `==` method
296
+ # @param [Object] Object to be compared
297
+ def eql?(o)
298
+ self == o
299
+ end
300
+
301
+ # Calculates hash code according to all attributes.
302
+ # @return [Integer] Hash code
303
+ def hash
304
+ [index, business_name, matching_score, business_registration_number, duns_number, business_tax_id_number, business_license_number, jurisdiction_of_incorporation, full_address, business_status, trade_style_name, business_type, address, other_business_names, website, telephone, tax_id_number, tax_id_numbers, email_address, web_domain, web_domains, naics, sic].hash
305
+ end
306
+
307
+ # :nocov:
308
+ # Builds the object from hash
309
+ # @param [Hash] attributes Model attributes in the form of hash
310
+ # @return [Object] Returns the model itself
311
+ def self.build_from_hash(attributes)
312
+ new.build_from_hash(attributes)
313
+ end
314
+ # :nocov:
315
+
316
+ # :nocov:
317
+ # Builds the object from hash
318
+ # @param [Hash] attributes Model attributes in the form of hash
319
+ # @return [Object] Returns the model itself
320
+ def build_from_hash(attributes)
321
+ return nil unless attributes.is_a?(Hash)
322
+ self.class.openapi_types.each_pair do |key, type|
323
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
324
+ self.send("#{key}=", nil)
325
+ elsif type =~ /\AArray<(.*)>/i
326
+ # check to ensure the input is an array given that the attribute
327
+ # is documented as an array but the input is not
328
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
329
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
330
+ end
331
+ elsif !attributes[self.class.attribute_map[key]].nil?
332
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
333
+ end
334
+ end
335
+
336
+ self
337
+ end
338
+ # :nocov:
339
+
340
+ # :nocov:
341
+ # Deserializes the data based on type
342
+ # @param string type Data type
343
+ # @param string value Value to be deserialized
344
+ # @return [Object] Deserialized data
345
+ def _deserialize(type, value)
346
+ case type.to_sym
347
+ when :Time
348
+ Time.parse(value)
349
+ when :Date
350
+ Date.parse(value)
351
+ when :String
352
+ value.to_s
353
+ when :Integer
354
+ value.to_i
355
+ when :Float
356
+ value.to_f
357
+ when :Boolean
358
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
359
+ true
360
+ else
361
+ false
362
+ end
363
+ when :Object
364
+ # generic object (usually a Hash), return directly
365
+ value
366
+ when /\AArray<(?<inner_type>.+)>\z/
367
+ inner_type = Regexp.last_match[:inner_type]
368
+ value.map { |v| _deserialize(inner_type, v) }
369
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
370
+ k_type = Regexp.last_match[:k_type]
371
+ v_type = Regexp.last_match[:v_type]
372
+ {}.tap do |hash|
373
+ value.each do |k, v|
374
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
375
+ end
376
+ end
377
+ else # model
378
+ # models (e.g. Pet) or oneOf
379
+ klass = Trulioo.const_get(type)
380
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
381
+ end
382
+ end
383
+ # :nocov:
384
+
385
+ # :nocov:
386
+ # Returns the string representation of the object
387
+ # @return [String] String presentation of the object
388
+ def to_s
389
+ to_hash.to_s
390
+ end
391
+ # :nocov:
392
+
393
+ # :nocov:
394
+ # to_body is an alias to to_hash (backward compatibility)
395
+ # @return [Hash] Returns the object in the form of hash
396
+ def to_body
397
+ to_hash
398
+ end
399
+ # :nocov:
400
+
401
+ # :nocov:
402
+ # Returns the object in the form of hash
403
+ # @return [Hash] Returns the object in the form of hash
404
+ def to_hash
405
+ hash = {}
406
+ self.class.attribute_map.each_pair do |attr, param|
407
+ value = self.send(attr)
408
+ if value.nil?
409
+ is_nullable = self.class.openapi_nullable.include?(attr)
410
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
411
+ end
412
+
413
+ hash[param] = _to_hash(value)
414
+ end
415
+ hash
416
+ end
417
+ # :nocov:
418
+
419
+ # :nocov:
420
+ # Outputs non-array value in the form of hash
421
+ # For object, use to_hash. Otherwise, just return the value
422
+ # @param [Object] value Any valid value
423
+ # @return [Hash] Returns the value in the form of hash
424
+ def _to_hash(value)
425
+ if value.is_a?(Array)
426
+ value.compact.map { |v| _to_hash(v) }
427
+ elsif value.is_a?(Hash)
428
+ {}.tap do |hash|
429
+ value.each { |k, v| hash[k] = _to_hash(v) }
430
+ end
431
+ elsif value.respond_to? :to_hash
432
+ value.to_hash
433
+ else
434
+ value
435
+ end
436
+ end
437
+ # :nocov:
438
+ end
439
+
440
+ end
@@ -0,0 +1,236 @@
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 ServiceError
14
+ attr_accessor :code
15
+
16
+ attr_accessor :message
17
+
18
+ # Attribute mapping from ruby-style variable name to JSON key.
19
+ def self.attribute_map
20
+ {
21
+ :'code' => :'Code',
22
+ :'message' => :'Message'
23
+ }
24
+ end
25
+
26
+ # Returns all the JSON keys this model knows about
27
+ def self.acceptable_attributes
28
+ attribute_map.values
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'code' => :'String',
35
+ :'message' => :'String'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Trulioo::ServiceError` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Trulioo::ServiceError`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'code')
61
+ self.code = attributes[:'code']
62
+ end
63
+
64
+ if attributes.key?(:'message')
65
+ self.message = attributes[:'message']
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ true
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(o)
85
+ return true if self.equal?(o)
86
+ self.class == o.class &&
87
+ code == o.code &&
88
+ message == o.message
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [code, message].hash
101
+ end
102
+
103
+ # :nocov:
104
+ # Builds the object from hash
105
+ # @param [Hash] attributes Model attributes in the form of hash
106
+ # @return [Object] Returns the model itself
107
+ def self.build_from_hash(attributes)
108
+ new.build_from_hash(attributes)
109
+ end
110
+ # :nocov:
111
+
112
+ # :nocov:
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def build_from_hash(attributes)
117
+ return nil unless attributes.is_a?(Hash)
118
+ self.class.openapi_types.each_pair do |key, type|
119
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
120
+ self.send("#{key}=", nil)
121
+ elsif type =~ /\AArray<(.*)>/i
122
+ # check to ensure the input is an array given that the attribute
123
+ # is documented as an array but the input is not
124
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
125
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
126
+ end
127
+ elsif !attributes[self.class.attribute_map[key]].nil?
128
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
129
+ end
130
+ end
131
+
132
+ self
133
+ end
134
+ # :nocov:
135
+
136
+ # :nocov:
137
+ # Deserializes the data based on type
138
+ # @param string type Data type
139
+ # @param string value Value to be deserialized
140
+ # @return [Object] Deserialized data
141
+ def _deserialize(type, value)
142
+ case type.to_sym
143
+ when :Time
144
+ Time.parse(value)
145
+ when :Date
146
+ Date.parse(value)
147
+ when :String
148
+ value.to_s
149
+ when :Integer
150
+ value.to_i
151
+ when :Float
152
+ value.to_f
153
+ when :Boolean
154
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
155
+ true
156
+ else
157
+ false
158
+ end
159
+ when :Object
160
+ # generic object (usually a Hash), return directly
161
+ value
162
+ when /\AArray<(?<inner_type>.+)>\z/
163
+ inner_type = Regexp.last_match[:inner_type]
164
+ value.map { |v| _deserialize(inner_type, v) }
165
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
166
+ k_type = Regexp.last_match[:k_type]
167
+ v_type = Regexp.last_match[:v_type]
168
+ {}.tap do |hash|
169
+ value.each do |k, v|
170
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
171
+ end
172
+ end
173
+ else # model
174
+ # models (e.g. Pet) or oneOf
175
+ klass = Trulioo.const_get(type)
176
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
177
+ end
178
+ end
179
+ # :nocov:
180
+
181
+ # :nocov:
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+ # :nocov:
188
+
189
+ # :nocov:
190
+ # to_body is an alias to to_hash (backward compatibility)
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_body
193
+ to_hash
194
+ end
195
+ # :nocov:
196
+
197
+ # :nocov:
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+ # :nocov:
214
+
215
+ # :nocov:
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+ # :nocov:
234
+ end
235
+
236
+ end