ultracart_api 4.1.51 → 4.1.54

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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -2
  3. data/docs/ConversationApi.md +111 -0
  4. data/docs/ConversationPbxAgent.md +2 -0
  5. data/docs/ConversationPbxCall.md +60 -0
  6. data/docs/ConversationPbxCallAgent.md +34 -0
  7. data/docs/ConversationPbxCallAiCost.md +24 -0
  8. data/docs/ConversationPbxCallAiEngagement.md +36 -0
  9. data/docs/ConversationPbxCallAiToolCall.md +34 -0
  10. data/docs/ConversationPbxCallAiWhisper.md +24 -0
  11. data/docs/ConversationPbxCallCaller.md +26 -0
  12. data/docs/ConversationPbxCallFinancial.md +30 -0
  13. data/docs/ConversationPbxCallHold.md +24 -0
  14. data/docs/ConversationPbxCallQueue.md +28 -0
  15. data/docs/ConversationPbxCallRecording.md +30 -0
  16. data/docs/ConversationPbxCallResponse.md +26 -0
  17. data/docs/ConversationPbxCallRouting.md +22 -0
  18. data/docs/ConversationPbxCallSearchRequest.md +48 -0
  19. data/docs/ConversationPbxCallSearchResponse.md +26 -0
  20. data/docs/ConversationPbxCallTimeline.md +28 -0
  21. data/docs/ConversationPbxCallTranscript.md +30 -0
  22. data/docs/ConversationPbxCallTranscriptSegment.md +30 -0
  23. data/docs/ConversationPbxCallTransfer.md +26 -0
  24. data/docs/ConversationPbxPhoneNumber.md +2 -0
  25. data/lib/ultracart_api/api/conversation_api.rb +142 -0
  26. data/lib/ultracart_api/models/conversation_pbx_agent.rb +11 -1
  27. data/lib/ultracart_api/models/conversation_pbx_call.rb +438 -0
  28. data/lib/ultracart_api/models/conversation_pbx_call_agent.rb +300 -0
  29. data/lib/ultracart_api/models/conversation_pbx_call_ai_cost.rb +250 -0
  30. data/lib/ultracart_api/models/conversation_pbx_call_ai_engagement.rb +347 -0
  31. data/lib/ultracart_api/models/conversation_pbx_call_ai_tool_call.rb +300 -0
  32. data/lib/ultracart_api/models/conversation_pbx_call_ai_whisper.rb +250 -0
  33. data/lib/ultracart_api/models/conversation_pbx_call_caller.rb +260 -0
  34. data/lib/ultracart_api/models/conversation_pbx_call_financial.rb +280 -0
  35. data/lib/ultracart_api/models/conversation_pbx_call_hold.rb +250 -0
  36. data/lib/ultracart_api/models/conversation_pbx_call_queue.rb +270 -0
  37. data/lib/ultracart_api/models/conversation_pbx_call_recording.rb +279 -0
  38. data/lib/ultracart_api/models/conversation_pbx_call_response.rb +256 -0
  39. data/lib/ultracart_api/models/conversation_pbx_call_routing.rb +239 -0
  40. data/lib/ultracart_api/models/conversation_pbx_call_search_request.rb +376 -0
  41. data/lib/ultracart_api/models/conversation_pbx_call_search_response.rb +259 -0
  42. data/lib/ultracart_api/models/conversation_pbx_call_timeline.rb +270 -0
  43. data/lib/ultracart_api/models/conversation_pbx_call_transcript.rb +282 -0
  44. data/lib/ultracart_api/models/conversation_pbx_call_transcript_segment.rb +314 -0
  45. data/lib/ultracart_api/models/conversation_pbx_call_transfer.rb +260 -0
  46. data/lib/ultracart_api/models/conversation_pbx_phone_number.rb +11 -1
  47. data/lib/ultracart_api/version.rb +1 -1
  48. data/lib/ultracart_api.rb +19 -0
  49. metadata +40 -2
@@ -0,0 +1,376 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class ConversationPbxCallSearchRequest
18
+ # Filter by agent IDs
19
+ attr_accessor :agent_ids
20
+
21
+ # Filter by customer name
22
+ attr_accessor :customer_name
23
+
24
+ # Filter by call direction (inbound/outbound)
25
+ attr_accessor :direction
26
+
27
+ # Filter by call disposition
28
+ attr_accessor :disposition
29
+
30
+ # Filter calls created on or before this date (ISO 8601)
31
+ attr_accessor :end_date
32
+
33
+ # Filter to calls with AI agent engagement
34
+ attr_accessor :has_ai_engagement
35
+
36
+ # Filter to calls that have a recording
37
+ attr_accessor :has_recording
38
+
39
+ # Filter to calls that have a transcript
40
+ attr_accessor :has_transcript
41
+
42
+ # Filter by maximum call duration in seconds
43
+ attr_accessor :max_duration_seconds
44
+
45
+ # Filter by minimum call duration in seconds
46
+ attr_accessor :min_duration_seconds
47
+
48
+ # Filter by phone number (partial match supported)
49
+ attr_accessor :phone_number
50
+
51
+ # Filter by queue UUIDs
52
+ attr_accessor :queue_uuids
53
+
54
+ # Free text search term - smart-routed based on content (phone, email, UUID, or general text)
55
+ attr_accessor :search_term
56
+
57
+ # Filter calls created on or after this date (ISO 8601)
58
+ attr_accessor :start_date
59
+
60
+ # Filter by call statuses
61
+ attr_accessor :statuses
62
+
63
+ # Search within transcript text
64
+ attr_accessor :transcript_search
65
+
66
+ # Attribute mapping from ruby-style variable name to JSON key.
67
+ def self.attribute_map
68
+ {
69
+ :'agent_ids' => :'agent_ids',
70
+ :'customer_name' => :'customer_name',
71
+ :'direction' => :'direction',
72
+ :'disposition' => :'disposition',
73
+ :'end_date' => :'end_date',
74
+ :'has_ai_engagement' => :'has_ai_engagement',
75
+ :'has_recording' => :'has_recording',
76
+ :'has_transcript' => :'has_transcript',
77
+ :'max_duration_seconds' => :'max_duration_seconds',
78
+ :'min_duration_seconds' => :'min_duration_seconds',
79
+ :'phone_number' => :'phone_number',
80
+ :'queue_uuids' => :'queue_uuids',
81
+ :'search_term' => :'search_term',
82
+ :'start_date' => :'start_date',
83
+ :'statuses' => :'statuses',
84
+ :'transcript_search' => :'transcript_search'
85
+ }
86
+ end
87
+
88
+ # Returns all the JSON keys this model knows about
89
+ def self.acceptable_attributes
90
+ attribute_map.values
91
+ end
92
+
93
+ # Attribute type mapping.
94
+ def self.openapi_types
95
+ {
96
+ :'agent_ids' => :'Array<String>',
97
+ :'customer_name' => :'String',
98
+ :'direction' => :'String',
99
+ :'disposition' => :'String',
100
+ :'end_date' => :'String',
101
+ :'has_ai_engagement' => :'Boolean',
102
+ :'has_recording' => :'Boolean',
103
+ :'has_transcript' => :'Boolean',
104
+ :'max_duration_seconds' => :'Integer',
105
+ :'min_duration_seconds' => :'Integer',
106
+ :'phone_number' => :'String',
107
+ :'queue_uuids' => :'Array<String>',
108
+ :'search_term' => :'String',
109
+ :'start_date' => :'String',
110
+ :'statuses' => :'Array<String>',
111
+ :'transcript_search' => :'String'
112
+ }
113
+ end
114
+
115
+ # List of attributes with nullable: true
116
+ def self.openapi_nullable
117
+ Set.new([
118
+ ])
119
+ end
120
+
121
+ # Initializes the object
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ def initialize(attributes = {})
124
+ if (!attributes.is_a?(Hash))
125
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ConversationPbxCallSearchRequest` initialize method"
126
+ end
127
+
128
+ # check to see if the attribute exists and convert string to symbol for hash key
129
+ attributes = attributes.each_with_object({}) { |(k, v), h|
130
+ if (!self.class.attribute_map.key?(k.to_sym))
131
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ConversationPbxCallSearchRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
132
+ end
133
+ h[k.to_sym] = v
134
+ }
135
+
136
+ if attributes.key?(:'agent_ids')
137
+ if (value = attributes[:'agent_ids']).is_a?(Array)
138
+ self.agent_ids = value
139
+ end
140
+ end
141
+
142
+ if attributes.key?(:'customer_name')
143
+ self.customer_name = attributes[:'customer_name']
144
+ end
145
+
146
+ if attributes.key?(:'direction')
147
+ self.direction = attributes[:'direction']
148
+ end
149
+
150
+ if attributes.key?(:'disposition')
151
+ self.disposition = attributes[:'disposition']
152
+ end
153
+
154
+ if attributes.key?(:'end_date')
155
+ self.end_date = attributes[:'end_date']
156
+ end
157
+
158
+ if attributes.key?(:'has_ai_engagement')
159
+ self.has_ai_engagement = attributes[:'has_ai_engagement']
160
+ end
161
+
162
+ if attributes.key?(:'has_recording')
163
+ self.has_recording = attributes[:'has_recording']
164
+ end
165
+
166
+ if attributes.key?(:'has_transcript')
167
+ self.has_transcript = attributes[:'has_transcript']
168
+ end
169
+
170
+ if attributes.key?(:'max_duration_seconds')
171
+ self.max_duration_seconds = attributes[:'max_duration_seconds']
172
+ end
173
+
174
+ if attributes.key?(:'min_duration_seconds')
175
+ self.min_duration_seconds = attributes[:'min_duration_seconds']
176
+ end
177
+
178
+ if attributes.key?(:'phone_number')
179
+ self.phone_number = attributes[:'phone_number']
180
+ end
181
+
182
+ if attributes.key?(:'queue_uuids')
183
+ if (value = attributes[:'queue_uuids']).is_a?(Array)
184
+ self.queue_uuids = value
185
+ end
186
+ end
187
+
188
+ if attributes.key?(:'search_term')
189
+ self.search_term = attributes[:'search_term']
190
+ end
191
+
192
+ if attributes.key?(:'start_date')
193
+ self.start_date = attributes[:'start_date']
194
+ end
195
+
196
+ if attributes.key?(:'statuses')
197
+ if (value = attributes[:'statuses']).is_a?(Array)
198
+ self.statuses = value
199
+ end
200
+ end
201
+
202
+ if attributes.key?(:'transcript_search')
203
+ self.transcript_search = attributes[:'transcript_search']
204
+ end
205
+ end
206
+
207
+ # Show invalid properties with the reasons. Usually used together with valid?
208
+ # @return Array for valid properties with the reasons
209
+ def list_invalid_properties
210
+ invalid_properties = Array.new
211
+ invalid_properties
212
+ end
213
+
214
+ # Check to see if the all the properties in the model are valid
215
+ # @return true if the model is valid
216
+ def valid?
217
+ true
218
+ end
219
+
220
+ # Checks equality by comparing each attribute.
221
+ # @param [Object] Object to be compared
222
+ def ==(o)
223
+ return true if self.equal?(o)
224
+ self.class == o.class &&
225
+ agent_ids == o.agent_ids &&
226
+ customer_name == o.customer_name &&
227
+ direction == o.direction &&
228
+ disposition == o.disposition &&
229
+ end_date == o.end_date &&
230
+ has_ai_engagement == o.has_ai_engagement &&
231
+ has_recording == o.has_recording &&
232
+ has_transcript == o.has_transcript &&
233
+ max_duration_seconds == o.max_duration_seconds &&
234
+ min_duration_seconds == o.min_duration_seconds &&
235
+ phone_number == o.phone_number &&
236
+ queue_uuids == o.queue_uuids &&
237
+ search_term == o.search_term &&
238
+ start_date == o.start_date &&
239
+ statuses == o.statuses &&
240
+ transcript_search == o.transcript_search
241
+ end
242
+
243
+ # @see the `==` method
244
+ # @param [Object] Object to be compared
245
+ def eql?(o)
246
+ self == o
247
+ end
248
+
249
+ # Calculates hash code according to all attributes.
250
+ # @return [Integer] Hash code
251
+ def hash
252
+ [agent_ids, customer_name, direction, disposition, end_date, has_ai_engagement, has_recording, has_transcript, max_duration_seconds, min_duration_seconds, phone_number, queue_uuids, search_term, start_date, statuses, transcript_search].hash
253
+ end
254
+
255
+ # Builds the object from hash
256
+ # @param [Hash] attributes Model attributes in the form of hash
257
+ # @return [Object] Returns the model itself
258
+ def self.build_from_hash(attributes)
259
+ new.build_from_hash(attributes)
260
+ end
261
+
262
+ # Builds the object from hash
263
+ # @param [Hash] attributes Model attributes in the form of hash
264
+ # @return [Object] Returns the model itself
265
+ def build_from_hash(attributes)
266
+ return nil unless attributes.is_a?(Hash)
267
+ attributes = attributes.transform_keys(&:to_sym)
268
+ self.class.openapi_types.each_pair do |key, type|
269
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
270
+ self.send("#{key}=", nil)
271
+ elsif type =~ /\AArray<(.*)>/i
272
+ # check to ensure the input is an array given that the attribute
273
+ # is documented as an array but the input is not
274
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
275
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
276
+ end
277
+ elsif !attributes[self.class.attribute_map[key]].nil?
278
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
279
+ end
280
+ end
281
+
282
+ self
283
+ end
284
+
285
+ # Deserializes the data based on type
286
+ # @param string type Data type
287
+ # @param string value Value to be deserialized
288
+ # @return [Object] Deserialized data
289
+ def _deserialize(type, value)
290
+ case type.to_sym
291
+ when :Time
292
+ Time.parse(value)
293
+ when :Date
294
+ Date.parse(value)
295
+ when :String
296
+ value.to_s
297
+ when :Integer
298
+ value.to_i
299
+ when :Float
300
+ value.to_f
301
+ when :Boolean
302
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
303
+ true
304
+ else
305
+ false
306
+ end
307
+ when :Object
308
+ # generic object (usually a Hash), return directly
309
+ value
310
+ when /\AArray<(?<inner_type>.+)>\z/
311
+ inner_type = Regexp.last_match[:inner_type]
312
+ value.map { |v| _deserialize(inner_type, v) }
313
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
314
+ k_type = Regexp.last_match[:k_type]
315
+ v_type = Regexp.last_match[:v_type]
316
+ {}.tap do |hash|
317
+ value.each do |k, v|
318
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
319
+ end
320
+ end
321
+ else # model
322
+ # models (e.g. Pet) or oneOf
323
+ klass = UltracartClient.const_get(type)
324
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
325
+ end
326
+ end
327
+
328
+ # Returns the string representation of the object
329
+ # @return [String] String presentation of the object
330
+ def to_s
331
+ to_hash.to_s
332
+ end
333
+
334
+ # to_body is an alias to to_hash (backward compatibility)
335
+ # @return [Hash] Returns the object in the form of hash
336
+ def to_body
337
+ to_hash
338
+ end
339
+
340
+ # Returns the object in the form of hash
341
+ # @return [Hash] Returns the object in the form of hash
342
+ def to_hash
343
+ hash = {}
344
+ self.class.attribute_map.each_pair do |attr, param|
345
+ value = self.send(attr)
346
+ if value.nil?
347
+ is_nullable = self.class.openapi_nullable.include?(attr)
348
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
349
+ end
350
+
351
+ hash[param] = _to_hash(value)
352
+ end
353
+ hash
354
+ end
355
+
356
+ # Outputs non-array value in the form of hash
357
+ # For object, use to_hash. Otherwise, just return the value
358
+ # @param [Object] value Any valid value
359
+ # @return [Hash] Returns the value in the form of hash
360
+ def _to_hash(value)
361
+ if value.is_a?(Array)
362
+ value.compact.map { |v| _to_hash(v) }
363
+ elsif value.is_a?(Hash)
364
+ {}.tap do |hash|
365
+ value.each { |k, v| hash[k] = _to_hash(v) }
366
+ end
367
+ elsif value.respond_to? :to_hash
368
+ value.to_hash
369
+ else
370
+ value
371
+ end
372
+ end
373
+
374
+ end
375
+
376
+ end
@@ -0,0 +1,259 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class ConversationPbxCallSearchResponse
18
+ # calls
19
+ attr_accessor :calls
20
+
21
+ attr_accessor :error
22
+
23
+ attr_accessor :metadata
24
+
25
+ # Indicates if API call was successful
26
+ attr_accessor :success
27
+
28
+ attr_accessor :warning
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'calls' => :'calls',
34
+ :'error' => :'error',
35
+ :'metadata' => :'metadata',
36
+ :'success' => :'success',
37
+ :'warning' => :'warning'
38
+ }
39
+ end
40
+
41
+ # Returns all the JSON keys this model knows about
42
+ def self.acceptable_attributes
43
+ attribute_map.values
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.openapi_types
48
+ {
49
+ :'calls' => :'Array<ConversationPbxCall>',
50
+ :'error' => :'Error',
51
+ :'metadata' => :'ResponseMetadata',
52
+ :'success' => :'Boolean',
53
+ :'warning' => :'Warning'
54
+ }
55
+ end
56
+
57
+ # List of attributes with nullable: true
58
+ def self.openapi_nullable
59
+ Set.new([
60
+ ])
61
+ end
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ def initialize(attributes = {})
66
+ if (!attributes.is_a?(Hash))
67
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ConversationPbxCallSearchResponse` initialize method"
68
+ end
69
+
70
+ # check to see if the attribute exists and convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h|
72
+ if (!self.class.attribute_map.key?(k.to_sym))
73
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ConversationPbxCallSearchResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74
+ end
75
+ h[k.to_sym] = v
76
+ }
77
+
78
+ if attributes.key?(:'calls')
79
+ if (value = attributes[:'calls']).is_a?(Array)
80
+ self.calls = value
81
+ end
82
+ end
83
+
84
+ if attributes.key?(:'error')
85
+ self.error = attributes[:'error']
86
+ end
87
+
88
+ if attributes.key?(:'metadata')
89
+ self.metadata = attributes[:'metadata']
90
+ end
91
+
92
+ if attributes.key?(:'success')
93
+ self.success = attributes[:'success']
94
+ end
95
+
96
+ if attributes.key?(:'warning')
97
+ self.warning = attributes[:'warning']
98
+ end
99
+ end
100
+
101
+ # Show invalid properties with the reasons. Usually used together with valid?
102
+ # @return Array for valid properties with the reasons
103
+ def list_invalid_properties
104
+ invalid_properties = Array.new
105
+ invalid_properties
106
+ end
107
+
108
+ # Check to see if the all the properties in the model are valid
109
+ # @return true if the model is valid
110
+ def valid?
111
+ true
112
+ end
113
+
114
+ # Checks equality by comparing each attribute.
115
+ # @param [Object] Object to be compared
116
+ def ==(o)
117
+ return true if self.equal?(o)
118
+ self.class == o.class &&
119
+ calls == o.calls &&
120
+ error == o.error &&
121
+ metadata == o.metadata &&
122
+ success == o.success &&
123
+ warning == o.warning
124
+ end
125
+
126
+ # @see the `==` method
127
+ # @param [Object] Object to be compared
128
+ def eql?(o)
129
+ self == o
130
+ end
131
+
132
+ # Calculates hash code according to all attributes.
133
+ # @return [Integer] Hash code
134
+ def hash
135
+ [calls, error, metadata, success, warning].hash
136
+ end
137
+
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 self.build_from_hash(attributes)
142
+ new.build_from_hash(attributes)
143
+ end
144
+
145
+ # Builds the object from hash
146
+ # @param [Hash] attributes Model attributes in the form of hash
147
+ # @return [Object] Returns the model itself
148
+ def build_from_hash(attributes)
149
+ return nil unless attributes.is_a?(Hash)
150
+ attributes = attributes.transform_keys(&:to_sym)
151
+ self.class.openapi_types.each_pair do |key, type|
152
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
153
+ self.send("#{key}=", nil)
154
+ elsif type =~ /\AArray<(.*)>/i
155
+ # check to ensure the input is an array given that the attribute
156
+ # is documented as an array but the input is not
157
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
158
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
159
+ end
160
+ elsif !attributes[self.class.attribute_map[key]].nil?
161
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
162
+ end
163
+ end
164
+
165
+ self
166
+ end
167
+
168
+ # Deserializes the data based on type
169
+ # @param string type Data type
170
+ # @param string value Value to be deserialized
171
+ # @return [Object] Deserialized data
172
+ def _deserialize(type, value)
173
+ case type.to_sym
174
+ when :Time
175
+ Time.parse(value)
176
+ when :Date
177
+ Date.parse(value)
178
+ when :String
179
+ value.to_s
180
+ when :Integer
181
+ value.to_i
182
+ when :Float
183
+ value.to_f
184
+ when :Boolean
185
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
186
+ true
187
+ else
188
+ false
189
+ end
190
+ when :Object
191
+ # generic object (usually a Hash), return directly
192
+ value
193
+ when /\AArray<(?<inner_type>.+)>\z/
194
+ inner_type = Regexp.last_match[:inner_type]
195
+ value.map { |v| _deserialize(inner_type, v) }
196
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
197
+ k_type = Regexp.last_match[:k_type]
198
+ v_type = Regexp.last_match[:v_type]
199
+ {}.tap do |hash|
200
+ value.each do |k, v|
201
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
202
+ end
203
+ end
204
+ else # model
205
+ # models (e.g. Pet) or oneOf
206
+ klass = UltracartClient.const_get(type)
207
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
208
+ end
209
+ end
210
+
211
+ # Returns the string representation of the object
212
+ # @return [String] String presentation of the object
213
+ def to_s
214
+ to_hash.to_s
215
+ end
216
+
217
+ # to_body is an alias to to_hash (backward compatibility)
218
+ # @return [Hash] Returns the object in the form of hash
219
+ def to_body
220
+ to_hash
221
+ end
222
+
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
+
239
+ # Outputs non-array value in the form of hash
240
+ # For object, use to_hash. Otherwise, just return the value
241
+ # @param [Object] value Any valid value
242
+ # @return [Hash] Returns the value in the form of hash
243
+ def _to_hash(value)
244
+ if value.is_a?(Array)
245
+ value.compact.map { |v| _to_hash(v) }
246
+ elsif value.is_a?(Hash)
247
+ {}.tap do |hash|
248
+ value.each { |k, v| hash[k] = _to_hash(v) }
249
+ end
250
+ elsif value.respond_to? :to_hash
251
+ value.to_hash
252
+ else
253
+ value
254
+ end
255
+ end
256
+
257
+ end
258
+
259
+ end