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