trinsic_api 0.2.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 (103) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +137 -0
  4. data/Rakefile +10 -0
  5. data/docs/Address.md +32 -0
  6. data/docs/Attachments.md +24 -0
  7. data/docs/AttachmentsApi.md +76 -0
  8. data/docs/CancelSessionResponse.md +18 -0
  9. data/docs/CreateSessionRequest.md +22 -0
  10. data/docs/CreateSessionResponse.md +20 -0
  11. data/docs/DisclosedFields.md +40 -0
  12. data/docs/DisclosedFieldsRequest.md +40 -0
  13. data/docs/DocumentData.md +28 -0
  14. data/docs/ExchangeAttachmentAccessKeyRequest.md +18 -0
  15. data/docs/ExchangeResultsKeyRequest.md +18 -0
  16. data/docs/ExchangeResultsKeyResponse.md +20 -0
  17. data/docs/FailureMessage.md +18 -0
  18. data/docs/GetSessionResponse.md +18 -0
  19. data/docs/IdentityData.md +24 -0
  20. data/docs/IdentityLookupResponse.md +18 -0
  21. data/docs/ListProvidersResponse.md +18 -0
  22. data/docs/ListSessionsResponse.md +22 -0
  23. data/docs/NetworkApi.md +140 -0
  24. data/docs/OrderDirection.md +15 -0
  25. data/docs/PersonData.md +34 -0
  26. data/docs/ProviderInfo.md +22 -0
  27. data/docs/Session.md +30 -0
  28. data/docs/SessionFailCode.md +15 -0
  29. data/docs/SessionOrdering.md +15 -0
  30. data/docs/SessionState.md +15 -0
  31. data/docs/SessionsApi.md +428 -0
  32. data/docs/ValidationResult.md +20 -0
  33. data/docs/Verification.md +20 -0
  34. data/docs/VerificationFailCode.md +15 -0
  35. data/git_push.sh +57 -0
  36. data/lib/trinsic_api/api/attachments_api.rb +84 -0
  37. data/lib/trinsic_api/api/network_api.rb +138 -0
  38. data/lib/trinsic_api/api/sessions_api.rb +418 -0
  39. data/lib/trinsic_api/api_client.rb +394 -0
  40. data/lib/trinsic_api/api_error.rb +58 -0
  41. data/lib/trinsic_api/configuration.rb +308 -0
  42. data/lib/trinsic_api/models/address.rb +279 -0
  43. data/lib/trinsic_api/models/attachments.rb +246 -0
  44. data/lib/trinsic_api/models/cancel_session_response.rb +221 -0
  45. data/lib/trinsic_api/models/create_session_request.rb +237 -0
  46. data/lib/trinsic_api/models/create_session_response.rb +232 -0
  47. data/lib/trinsic_api/models/disclosed_fields.rb +397 -0
  48. data/lib/trinsic_api/models/disclosed_fields_request.rb +313 -0
  49. data/lib/trinsic_api/models/document_data.rb +259 -0
  50. data/lib/trinsic_api/models/exchange_attachment_access_key_request.rb +241 -0
  51. data/lib/trinsic_api/models/exchange_results_key_request.rb +222 -0
  52. data/lib/trinsic_api/models/exchange_results_key_response.rb +230 -0
  53. data/lib/trinsic_api/models/failure_message.rb +221 -0
  54. data/lib/trinsic_api/models/get_session_response.rb +221 -0
  55. data/lib/trinsic_api/models/identity_data.rb +245 -0
  56. data/lib/trinsic_api/models/identity_lookup_response.rb +222 -0
  57. data/lib/trinsic_api/models/list_providers_response.rb +224 -0
  58. data/lib/trinsic_api/models/list_sessions_response.rb +257 -0
  59. data/lib/trinsic_api/models/order_direction.rb +40 -0
  60. data/lib/trinsic_api/models/person_data.rb +292 -0
  61. data/lib/trinsic_api/models/provider_info.rb +257 -0
  62. data/lib/trinsic_api/models/session.rb +338 -0
  63. data/lib/trinsic_api/models/session_fail_code.rb +45 -0
  64. data/lib/trinsic_api/models/session_ordering.rb +41 -0
  65. data/lib/trinsic_api/models/session_state.rb +44 -0
  66. data/lib/trinsic_api/models/validation_result.rb +232 -0
  67. data/lib/trinsic_api/models/verification.rb +248 -0
  68. data/lib/trinsic_api/models/verification_fail_code.rb +43 -0
  69. data/lib/trinsic_api/version.rb +15 -0
  70. data/lib/trinsic_api.rb +69 -0
  71. data/spec/api/attachments_api_spec.rb +46 -0
  72. data/spec/api/network_api_spec.rb +56 -0
  73. data/spec/api/sessions_api_spec.rb +105 -0
  74. data/spec/models/address_spec.rb +78 -0
  75. data/spec/models/attachments_spec.rb +54 -0
  76. data/spec/models/cancel_session_response_spec.rb +36 -0
  77. data/spec/models/create_session_request_spec.rb +48 -0
  78. data/spec/models/create_session_response_spec.rb +42 -0
  79. data/spec/models/disclosed_fields_request_spec.rb +102 -0
  80. data/spec/models/disclosed_fields_spec.rb +102 -0
  81. data/spec/models/document_data_spec.rb +66 -0
  82. data/spec/models/exchange_attachment_access_key_request_spec.rb +36 -0
  83. data/spec/models/exchange_results_key_request_spec.rb +36 -0
  84. data/spec/models/exchange_results_key_response_spec.rb +42 -0
  85. data/spec/models/failure_message_spec.rb +36 -0
  86. data/spec/models/get_session_response_spec.rb +36 -0
  87. data/spec/models/identity_data_spec.rb +54 -0
  88. data/spec/models/identity_lookup_response_spec.rb +36 -0
  89. data/spec/models/list_providers_response_spec.rb +36 -0
  90. data/spec/models/list_sessions_response_spec.rb +48 -0
  91. data/spec/models/order_direction_spec.rb +30 -0
  92. data/spec/models/person_data_spec.rb +84 -0
  93. data/spec/models/provider_info_spec.rb +48 -0
  94. data/spec/models/session_fail_code_spec.rb +30 -0
  95. data/spec/models/session_ordering_spec.rb +30 -0
  96. data/spec/models/session_spec.rb +72 -0
  97. data/spec/models/session_state_spec.rb +30 -0
  98. data/spec/models/validation_result_spec.rb +42 -0
  99. data/spec/models/verification_fail_code_spec.rb +30 -0
  100. data/spec/models/verification_spec.rb +42 -0
  101. data/spec/spec_helper.rb +111 -0
  102. data/trinsic_api.gemspec +39 -0
  103. metadata +215 -0
@@ -0,0 +1,40 @@
1
+ =begin
2
+ #Connect API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.7.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrinsicApi
17
+ class OrderDirection
18
+ ASCENDING = "Ascending".freeze
19
+ DESCENDING = "Descending".freeze
20
+
21
+ def self.all_vars
22
+ @all_vars ||= [ASCENDING, DESCENDING].freeze
23
+ end
24
+
25
+ # Builds the enum from string
26
+ # @param [String] The enum value in the form of the string
27
+ # @return [String] The enum value
28
+ def self.build_from_hash(value)
29
+ new.build_from_hash(value)
30
+ end
31
+
32
+ # Builds the enum from string
33
+ # @param [String] The enum value in the form of the string
34
+ # @return [String] The enum value
35
+ def build_from_hash(value)
36
+ return value if OrderDirection.all_vars.include?(value)
37
+ raise "Invalid ENUM value #{value} for class #OrderDirection"
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,292 @@
1
+ =begin
2
+ #Connect API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.7.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrinsicApi
17
+ # Identity information for the individual being verified
18
+ class PersonData
19
+ # Given (first) name of the individual
20
+ attr_accessor :given_name
21
+
22
+ # Family (last) name of the individual
23
+ attr_accessor :family_name
24
+
25
+ # Middle name of the individual
26
+ attr_accessor :middle_name
27
+
28
+ # The individual's full name as a single string. Useful for names which do not fit into a \"first middle last\" structure.
29
+ attr_accessor :full_name
30
+
31
+ attr_accessor :nationality
32
+
33
+ attr_accessor :gender
34
+
35
+ attr_accessor :phone_number
36
+
37
+ # Address information for an individual
38
+ attr_accessor :address
39
+
40
+ attr_accessor :date_of_birth
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'given_name' => :'givenName',
46
+ :'family_name' => :'familyName',
47
+ :'middle_name' => :'middleName',
48
+ :'full_name' => :'fullName',
49
+ :'nationality' => :'nationality',
50
+ :'gender' => :'gender',
51
+ :'phone_number' => :'phoneNumber',
52
+ :'address' => :'address',
53
+ :'date_of_birth' => :'dateOfBirth'
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
+ :'given_name' => :'String',
66
+ :'family_name' => :'String',
67
+ :'middle_name' => :'String',
68
+ :'full_name' => :'String',
69
+ :'nationality' => :'String',
70
+ :'gender' => :'String',
71
+ :'phone_number' => :'String',
72
+ :'address' => :'Address',
73
+ :'date_of_birth' => :'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 `TrinsicApi::PersonData` 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 `TrinsicApi::PersonData`. 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?(:'given_name')
99
+ self.given_name = attributes[:'given_name']
100
+ end
101
+
102
+ if attributes.key?(:'family_name')
103
+ self.family_name = attributes[:'family_name']
104
+ end
105
+
106
+ if attributes.key?(:'middle_name')
107
+ self.middle_name = attributes[:'middle_name']
108
+ end
109
+
110
+ if attributes.key?(:'full_name')
111
+ self.full_name = attributes[:'full_name']
112
+ end
113
+
114
+ if attributes.key?(:'nationality')
115
+ self.nationality = attributes[:'nationality']
116
+ end
117
+
118
+ if attributes.key?(:'gender')
119
+ self.gender = attributes[:'gender']
120
+ end
121
+
122
+ if attributes.key?(:'phone_number')
123
+ self.phone_number = attributes[:'phone_number']
124
+ end
125
+
126
+ if attributes.key?(:'address')
127
+ self.address = attributes[:'address']
128
+ end
129
+
130
+ if attributes.key?(:'date_of_birth')
131
+ self.date_of_birth = attributes[:'date_of_birth']
132
+ end
133
+ end
134
+
135
+ # Show invalid properties with the reasons. Usually used together with valid?
136
+ # @return Array for valid properties with the reasons
137
+ def list_invalid_properties
138
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
139
+ invalid_properties = Array.new
140
+ invalid_properties
141
+ end
142
+
143
+ # Check to see if the all the properties in the model are valid
144
+ # @return true if the model is valid
145
+ def valid?
146
+ warn '[DEPRECATED] the `valid?` method is obsolete'
147
+ true
148
+ end
149
+
150
+ # Checks equality by comparing each attribute.
151
+ # @param [Object] Object to be compared
152
+ def ==(o)
153
+ return true if self.equal?(o)
154
+ self.class == o.class &&
155
+ given_name == o.given_name &&
156
+ family_name == o.family_name &&
157
+ middle_name == o.middle_name &&
158
+ full_name == o.full_name &&
159
+ nationality == o.nationality &&
160
+ gender == o.gender &&
161
+ phone_number == o.phone_number &&
162
+ address == o.address &&
163
+ date_of_birth == o.date_of_birth
164
+ end
165
+
166
+ # @see the `==` method
167
+ # @param [Object] Object to be compared
168
+ def eql?(o)
169
+ self == o
170
+ end
171
+
172
+ # Calculates hash code according to all attributes.
173
+ # @return [Integer] Hash code
174
+ def hash
175
+ [given_name, family_name, middle_name, full_name, nationality, gender, phone_number, address, date_of_birth].hash
176
+ end
177
+
178
+ # Builds the object from hash
179
+ # @param [Hash] attributes Model attributes in the form of hash
180
+ # @return [Object] Returns the model itself
181
+ def self.build_from_hash(attributes)
182
+ return nil unless attributes.is_a?(Hash)
183
+ attributes = attributes.transform_keys(&:to_sym)
184
+ transformed_hash = {}
185
+ openapi_types.each_pair do |key, type|
186
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
187
+ transformed_hash["#{key}"] = nil
188
+ elsif type =~ /\AArray<(.*)>/i
189
+ # check to ensure the input is an array given that the attribute
190
+ # is documented as an array but the input is not
191
+ if attributes[attribute_map[key]].is_a?(Array)
192
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
193
+ end
194
+ elsif !attributes[attribute_map[key]].nil?
195
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
196
+ end
197
+ end
198
+ new(transformed_hash)
199
+ end
200
+
201
+ # Deserializes the data based on type
202
+ # @param string type Data type
203
+ # @param string value Value to be deserialized
204
+ # @return [Object] Deserialized data
205
+ def self._deserialize(type, value)
206
+ case type.to_sym
207
+ when :Time
208
+ Time.parse(value)
209
+ when :Date
210
+ Date.parse(value)
211
+ when :String
212
+ value.to_s
213
+ when :Integer
214
+ value.to_i
215
+ when :Float
216
+ value.to_f
217
+ when :Boolean
218
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
219
+ true
220
+ else
221
+ false
222
+ end
223
+ when :Object
224
+ # generic object (usually a Hash), return directly
225
+ value
226
+ when /\AArray<(?<inner_type>.+)>\z/
227
+ inner_type = Regexp.last_match[:inner_type]
228
+ value.map { |v| _deserialize(inner_type, v) }
229
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
230
+ k_type = Regexp.last_match[:k_type]
231
+ v_type = Regexp.last_match[:v_type]
232
+ {}.tap do |hash|
233
+ value.each do |k, v|
234
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
235
+ end
236
+ end
237
+ else # model
238
+ # models (e.g. Pet) or oneOf
239
+ klass = TrinsicApi.const_get(type)
240
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
241
+ end
242
+ end
243
+
244
+ # Returns the string representation of the object
245
+ # @return [String] String presentation of the object
246
+ def to_s
247
+ to_hash.to_s
248
+ end
249
+
250
+ # to_body is an alias to to_hash (backward compatibility)
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_body
253
+ to_hash
254
+ end
255
+
256
+ # Returns the object in the form of hash
257
+ # @return [Hash] Returns the object in the form of hash
258
+ def to_hash
259
+ hash = {}
260
+ self.class.attribute_map.each_pair do |attr, param|
261
+ value = self.send(attr)
262
+ if value.nil?
263
+ is_nullable = self.class.openapi_nullable.include?(attr)
264
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
265
+ end
266
+
267
+ hash[param] = _to_hash(value)
268
+ end
269
+ hash
270
+ end
271
+
272
+ # Outputs non-array value in the form of hash
273
+ # For object, use to_hash. Otherwise, just return the value
274
+ # @param [Object] value Any valid value
275
+ # @return [Hash] Returns the value in the form of hash
276
+ def _to_hash(value)
277
+ if value.is_a?(Array)
278
+ value.compact.map { |v| _to_hash(v) }
279
+ elsif value.is_a?(Hash)
280
+ {}.tap do |hash|
281
+ value.each { |k, v| hash[k] = _to_hash(v) }
282
+ end
283
+ elsif value.respond_to? :to_hash
284
+ value.to_hash
285
+ else
286
+ value
287
+ end
288
+ end
289
+
290
+ end
291
+
292
+ end
@@ -0,0 +1,257 @@
1
+ =begin
2
+ #Connect API
3
+
4
+ #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+
6
+ The version of the OpenAPI document: v1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.7.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module TrinsicApi
17
+ # A provider that can be specified when creating a `Session`
18
+ class ProviderInfo
19
+ # The ID of the provider
20
+ attr_accessor :id
21
+
22
+ # The friendly, human-readable name of the provider
23
+ attr_accessor :name
24
+
25
+ # A URL pointing to the provider's logo
26
+ attr_accessor :logo_url
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'id' => :'id',
32
+ :'name' => :'name',
33
+ :'logo_url' => :'logoUrl'
34
+ }
35
+ end
36
+
37
+ # Returns all the JSON keys this model knows about
38
+ def self.acceptable_attributes
39
+ attribute_map.values
40
+ end
41
+
42
+ # Attribute type mapping.
43
+ def self.openapi_types
44
+ {
45
+ :'id' => :'String',
46
+ :'name' => :'String',
47
+ :'logo_url' => :'String'
48
+ }
49
+ end
50
+
51
+ # List of attributes with nullable: true
52
+ def self.openapi_nullable
53
+ Set.new([
54
+ ])
55
+ end
56
+
57
+ # Initializes the object
58
+ # @param [Hash] attributes Model attributes in the form of hash
59
+ def initialize(attributes = {})
60
+ if (!attributes.is_a?(Hash))
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TrinsicApi::ProviderInfo` initialize method"
62
+ end
63
+
64
+ # check to see if the attribute exists and convert string to symbol for hash key
65
+ attributes = attributes.each_with_object({}) { |(k, v), h|
66
+ if (!self.class.attribute_map.key?(k.to_sym))
67
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TrinsicApi::ProviderInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
68
+ end
69
+ h[k.to_sym] = v
70
+ }
71
+
72
+ if attributes.key?(:'id')
73
+ self.id = attributes[:'id']
74
+ else
75
+ self.id = nil
76
+ end
77
+
78
+ if attributes.key?(:'name')
79
+ self.name = attributes[:'name']
80
+ else
81
+ self.name = nil
82
+ end
83
+
84
+ if attributes.key?(:'logo_url')
85
+ self.logo_url = attributes[:'logo_url']
86
+ else
87
+ self.logo_url = nil
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
95
+ invalid_properties = Array.new
96
+ if @id.nil?
97
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
98
+ end
99
+
100
+ if @name.nil?
101
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
102
+ end
103
+
104
+ if @logo_url.nil?
105
+ invalid_properties.push('invalid value for "logo_url", logo_url cannot be nil.')
106
+ end
107
+
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
+ return false if @id.nil?
116
+ return false if @name.nil?
117
+ return false if @logo_url.nil?
118
+ true
119
+ end
120
+
121
+ # Checks equality by comparing each attribute.
122
+ # @param [Object] Object to be compared
123
+ def ==(o)
124
+ return true if self.equal?(o)
125
+ self.class == o.class &&
126
+ id == o.id &&
127
+ name == o.name &&
128
+ logo_url == o.logo_url
129
+ end
130
+
131
+ # @see the `==` method
132
+ # @param [Object] Object to be compared
133
+ def eql?(o)
134
+ self == o
135
+ end
136
+
137
+ # Calculates hash code according to all attributes.
138
+ # @return [Integer] Hash code
139
+ def hash
140
+ [id, name, logo_url].hash
141
+ end
142
+
143
+ # Builds the object from hash
144
+ # @param [Hash] attributes Model attributes in the form of hash
145
+ # @return [Object] Returns the model itself
146
+ def self.build_from_hash(attributes)
147
+ return nil unless attributes.is_a?(Hash)
148
+ attributes = attributes.transform_keys(&:to_sym)
149
+ transformed_hash = {}
150
+ openapi_types.each_pair do |key, type|
151
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
152
+ transformed_hash["#{key}"] = nil
153
+ elsif type =~ /\AArray<(.*)>/i
154
+ # check to ensure the input is an array given that the attribute
155
+ # is documented as an array but the input is not
156
+ if attributes[attribute_map[key]].is_a?(Array)
157
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
158
+ end
159
+ elsif !attributes[attribute_map[key]].nil?
160
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
161
+ end
162
+ end
163
+ new(transformed_hash)
164
+ end
165
+
166
+ # Deserializes the data based on type
167
+ # @param string type Data type
168
+ # @param string value Value to be deserialized
169
+ # @return [Object] Deserialized data
170
+ def self._deserialize(type, value)
171
+ case type.to_sym
172
+ when :Time
173
+ Time.parse(value)
174
+ when :Date
175
+ Date.parse(value)
176
+ when :String
177
+ value.to_s
178
+ when :Integer
179
+ value.to_i
180
+ when :Float
181
+ value.to_f
182
+ when :Boolean
183
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
184
+ true
185
+ else
186
+ false
187
+ end
188
+ when :Object
189
+ # generic object (usually a Hash), return directly
190
+ value
191
+ when /\AArray<(?<inner_type>.+)>\z/
192
+ inner_type = Regexp.last_match[:inner_type]
193
+ value.map { |v| _deserialize(inner_type, v) }
194
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
195
+ k_type = Regexp.last_match[:k_type]
196
+ v_type = Regexp.last_match[:v_type]
197
+ {}.tap do |hash|
198
+ value.each do |k, v|
199
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
200
+ end
201
+ end
202
+ else # model
203
+ # models (e.g. Pet) or oneOf
204
+ klass = TrinsicApi.const_get(type)
205
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ # Returns the string representation of the object
210
+ # @return [String] String presentation of the object
211
+ def to_s
212
+ to_hash.to_s
213
+ end
214
+
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
+
221
+ # Returns the object in the form of hash
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_hash
224
+ hash = {}
225
+ self.class.attribute_map.each_pair do |attr, param|
226
+ value = self.send(attr)
227
+ if value.nil?
228
+ is_nullable = self.class.openapi_nullable.include?(attr)
229
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
230
+ end
231
+
232
+ hash[param] = _to_hash(value)
233
+ end
234
+ hash
235
+ end
236
+
237
+ # Outputs non-array value in the form of hash
238
+ # For object, use to_hash. Otherwise, just return the value
239
+ # @param [Object] value Any valid value
240
+ # @return [Hash] Returns the value in the form of hash
241
+ def _to_hash(value)
242
+ if value.is_a?(Array)
243
+ value.compact.map { |v| _to_hash(v) }
244
+ elsif value.is_a?(Hash)
245
+ {}.tap do |hash|
246
+ value.each { |k, v| hash[k] = _to_hash(v) }
247
+ end
248
+ elsif value.respond_to? :to_hash
249
+ value.to_hash
250
+ else
251
+ value
252
+ end
253
+ end
254
+
255
+ end
256
+
257
+ end