ultracart_api 4.1.80 → 4.1.82

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 +34 -2
  3. data/docs/AgentSummary.md +30 -0
  4. data/docs/ConversationAgentCallEvent.md +30 -0
  5. data/docs/ConversationAgentChatEvent.md +26 -0
  6. data/docs/ConversationAgentStatusConfig.md +42 -0
  7. data/docs/ConversationAgentStatusConfigResponse.md +26 -0
  8. data/docs/ConversationAgentStatusConfigsResponse.md +26 -0
  9. data/docs/ConversationAgentStatusEvent.md +48 -0
  10. data/docs/ConversationAgentStatusHeatmapRequest.md +24 -0
  11. data/docs/ConversationAgentStatusHeatmapResponse.md +30 -0
  12. data/docs/ConversationAgentStatusHistorySearchRequest.md +28 -0
  13. data/docs/ConversationAgentStatusHistorySearchResponse.md +28 -0
  14. data/docs/ConversationAgentStatusRollup.md +38 -0
  15. data/docs/ConversationAgentStatusRollupSearchRequest.md +24 -0
  16. data/docs/ConversationAgentStatusRollupSearchResponse.md +26 -0
  17. data/docs/ConversationAgentStatusSummaryResponse.md +32 -0
  18. data/docs/ConversationAgentStatusTimelineResponse.md +32 -0
  19. data/docs/ConversationApi.md +600 -0
  20. data/docs/ConversationPbxDefaultTimezoneResponse.md +26 -0
  21. data/docs/ConversationPbxDefaultTimezoneUpdateRequest.md +18 -0
  22. data/docs/ConversationWebchatQueueStatusAgent.md +6 -0
  23. data/docs/ConversationWebchatQueueStatusUpdateRequest.md +5 -1
  24. data/docs/TimelineSummary.md +26 -0
  25. data/lib/ultracart_api/api/conversation_api.rb +766 -2
  26. data/lib/ultracart_api/models/agent_summary.rb +279 -0
  27. data/lib/ultracart_api/models/conversation_agent_call_event.rb +314 -0
  28. data/lib/ultracart_api/models/conversation_agent_chat_event.rb +260 -0
  29. data/lib/ultracart_api/models/conversation_agent_status_config.rb +461 -0
  30. data/lib/ultracart_api/models/conversation_agent_status_config_response.rb +256 -0
  31. data/lib/ultracart_api/models/conversation_agent_status_configs_response.rb +259 -0
  32. data/lib/ultracart_api/models/conversation_agent_status_event.rb +512 -0
  33. data/lib/ultracart_api/models/conversation_agent_status_heatmap_request.rb +296 -0
  34. data/lib/ultracart_api/models/conversation_agent_status_heatmap_response.rb +283 -0
  35. data/lib/ultracart_api/models/conversation_agent_status_history_search_request.rb +316 -0
  36. data/lib/ultracart_api/models/conversation_agent_status_history_search_response.rb +269 -0
  37. data/lib/ultracart_api/models/conversation_agent_status_rollup.rb +353 -0
  38. data/lib/ultracart_api/models/conversation_agent_status_rollup_search_request.rb +284 -0
  39. data/lib/ultracart_api/models/conversation_agent_status_rollup_search_response.rb +259 -0
  40. data/lib/ultracart_api/models/conversation_agent_status_summary_response.rb +288 -0
  41. data/lib/ultracart_api/models/conversation_agent_status_timeline_response.rb +292 -0
  42. data/lib/ultracart_api/models/conversation_pbx_default_timezone_response.rb +272 -0
  43. data/lib/ultracart_api/models/conversation_pbx_default_timezone_update_request.rb +235 -0
  44. data/lib/ultracart_api/models/conversation_webchat_queue_status_agent.rb +31 -1
  45. data/lib/ultracart_api/models/conversation_webchat_queue_status_update_request.rb +24 -4
  46. data/lib/ultracart_api/models/timeline_summary.rb +260 -0
  47. data/lib/ultracart_api/version.rb +1 -1
  48. data/lib/ultracart_api.rb +19 -0
  49. metadata +40 -2
@@ -0,0 +1,353 @@
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 ConversationAgentStatusRollup
18
+ # Agent display name
19
+ attr_accessor :agent_name
20
+
21
+ # Agent user id
22
+ attr_accessor :agent_user_id
23
+
24
+ attr_accessor :availability_pct
25
+
26
+ # Seconds spent Available (incl. Busy per OVERVIEW reporting convention)
27
+ attr_accessor :available_seconds
28
+
29
+ # Calls handled by the agent on this day (PBX channel only)
30
+ attr_accessor :calls_taken
31
+
32
+ # Channel
33
+ attr_accessor :channel
34
+
35
+ # Chats handled by the agent on this day (chat channel only)
36
+ attr_accessor :chats_handled
37
+
38
+ # Day this rollup covers (YYYY-MM-DD)
39
+ attr_accessor :rollup_date
40
+
41
+ # Per-status duration breakdown in seconds (status name -> seconds)
42
+ attr_accessor :status_breakdown
43
+
44
+ # Total seconds tracked across all statuses for the day
45
+ attr_accessor :total_tracked_seconds
46
+
47
+ # Seconds spent Unavailable
48
+ attr_accessor :unavailable_seconds
49
+
50
+ class EnumAttributeValidator
51
+ attr_reader :datatype
52
+ attr_reader :allowable_values
53
+
54
+ def initialize(datatype, allowable_values)
55
+ @allowable_values = allowable_values.map do |value|
56
+ case datatype.to_s
57
+ when /Integer/i
58
+ value.to_i
59
+ when /Float/i
60
+ value.to_f
61
+ else
62
+ value
63
+ end
64
+ end
65
+ end
66
+
67
+ def valid?(value)
68
+ !value || allowable_values.include?(value)
69
+ end
70
+ end
71
+
72
+ # Attribute mapping from ruby-style variable name to JSON key.
73
+ def self.attribute_map
74
+ {
75
+ :'agent_name' => :'agent_name',
76
+ :'agent_user_id' => :'agent_user_id',
77
+ :'availability_pct' => :'availability_pct',
78
+ :'available_seconds' => :'available_seconds',
79
+ :'calls_taken' => :'calls_taken',
80
+ :'channel' => :'channel',
81
+ :'chats_handled' => :'chats_handled',
82
+ :'rollup_date' => :'rollup_date',
83
+ :'status_breakdown' => :'status_breakdown',
84
+ :'total_tracked_seconds' => :'total_tracked_seconds',
85
+ :'unavailable_seconds' => :'unavailable_seconds'
86
+ }
87
+ end
88
+
89
+ # Returns all the JSON keys this model knows about
90
+ def self.acceptable_attributes
91
+ attribute_map.values
92
+ end
93
+
94
+ # Attribute type mapping.
95
+ def self.openapi_types
96
+ {
97
+ :'agent_name' => :'String',
98
+ :'agent_user_id' => :'String',
99
+ :'availability_pct' => :'Object',
100
+ :'available_seconds' => :'Integer',
101
+ :'calls_taken' => :'Integer',
102
+ :'channel' => :'String',
103
+ :'chats_handled' => :'Integer',
104
+ :'rollup_date' => :'String',
105
+ :'status_breakdown' => :'Object',
106
+ :'total_tracked_seconds' => :'Integer',
107
+ :'unavailable_seconds' => :'Integer'
108
+ }
109
+ end
110
+
111
+ # List of attributes with nullable: true
112
+ def self.openapi_nullable
113
+ Set.new([
114
+ ])
115
+ end
116
+
117
+ # Initializes the object
118
+ # @param [Hash] attributes Model attributes in the form of hash
119
+ def initialize(attributes = {})
120
+ if (!attributes.is_a?(Hash))
121
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ConversationAgentStatusRollup` initialize method"
122
+ end
123
+
124
+ # check to see if the attribute exists and convert string to symbol for hash key
125
+ attributes = attributes.each_with_object({}) { |(k, v), h|
126
+ if (!self.class.attribute_map.key?(k.to_sym))
127
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ConversationAgentStatusRollup`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
128
+ end
129
+ h[k.to_sym] = v
130
+ }
131
+
132
+ if attributes.key?(:'agent_name')
133
+ self.agent_name = attributes[:'agent_name']
134
+ end
135
+
136
+ if attributes.key?(:'agent_user_id')
137
+ self.agent_user_id = attributes[:'agent_user_id']
138
+ end
139
+
140
+ if attributes.key?(:'availability_pct')
141
+ self.availability_pct = attributes[:'availability_pct']
142
+ end
143
+
144
+ if attributes.key?(:'available_seconds')
145
+ self.available_seconds = attributes[:'available_seconds']
146
+ end
147
+
148
+ if attributes.key?(:'calls_taken')
149
+ self.calls_taken = attributes[:'calls_taken']
150
+ end
151
+
152
+ if attributes.key?(:'channel')
153
+ self.channel = attributes[:'channel']
154
+ end
155
+
156
+ if attributes.key?(:'chats_handled')
157
+ self.chats_handled = attributes[:'chats_handled']
158
+ end
159
+
160
+ if attributes.key?(:'rollup_date')
161
+ self.rollup_date = attributes[:'rollup_date']
162
+ end
163
+
164
+ if attributes.key?(:'status_breakdown')
165
+ self.status_breakdown = attributes[:'status_breakdown']
166
+ end
167
+
168
+ if attributes.key?(:'total_tracked_seconds')
169
+ self.total_tracked_seconds = attributes[:'total_tracked_seconds']
170
+ end
171
+
172
+ if attributes.key?(:'unavailable_seconds')
173
+ self.unavailable_seconds = attributes[:'unavailable_seconds']
174
+ end
175
+ end
176
+
177
+ # Show invalid properties with the reasons. Usually used together with valid?
178
+ # @return Array for valid properties with the reasons
179
+ def list_invalid_properties
180
+ invalid_properties = Array.new
181
+ invalid_properties
182
+ end
183
+
184
+ # Check to see if the all the properties in the model are valid
185
+ # @return true if the model is valid
186
+ def valid?
187
+ channel_validator = EnumAttributeValidator.new('String', ["pbx", "chat"])
188
+ return false unless channel_validator.valid?(@channel)
189
+ true
190
+ end
191
+
192
+ # Custom attribute writer method checking allowed values (enum).
193
+ # @param [Object] channel Object to be assigned
194
+ def channel=(channel)
195
+ validator = EnumAttributeValidator.new('String', ["pbx", "chat"])
196
+ unless validator.valid?(channel)
197
+ fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}."
198
+ end
199
+ @channel = channel
200
+ end
201
+
202
+ # Checks equality by comparing each attribute.
203
+ # @param [Object] Object to be compared
204
+ def ==(o)
205
+ return true if self.equal?(o)
206
+ self.class == o.class &&
207
+ agent_name == o.agent_name &&
208
+ agent_user_id == o.agent_user_id &&
209
+ availability_pct == o.availability_pct &&
210
+ available_seconds == o.available_seconds &&
211
+ calls_taken == o.calls_taken &&
212
+ channel == o.channel &&
213
+ chats_handled == o.chats_handled &&
214
+ rollup_date == o.rollup_date &&
215
+ status_breakdown == o.status_breakdown &&
216
+ total_tracked_seconds == o.total_tracked_seconds &&
217
+ unavailable_seconds == o.unavailable_seconds
218
+ end
219
+
220
+ # @see the `==` method
221
+ # @param [Object] Object to be compared
222
+ def eql?(o)
223
+ self == o
224
+ end
225
+
226
+ # Calculates hash code according to all attributes.
227
+ # @return [Integer] Hash code
228
+ def hash
229
+ [agent_name, agent_user_id, availability_pct, available_seconds, calls_taken, channel, chats_handled, rollup_date, status_breakdown, total_tracked_seconds, unavailable_seconds].hash
230
+ end
231
+
232
+ # Builds the object from hash
233
+ # @param [Hash] attributes Model attributes in the form of hash
234
+ # @return [Object] Returns the model itself
235
+ def self.build_from_hash(attributes)
236
+ new.build_from_hash(attributes)
237
+ end
238
+
239
+ # Builds the object from hash
240
+ # @param [Hash] attributes Model attributes in the form of hash
241
+ # @return [Object] Returns the model itself
242
+ def build_from_hash(attributes)
243
+ return nil unless attributes.is_a?(Hash)
244
+ attributes = attributes.transform_keys(&:to_sym)
245
+ self.class.openapi_types.each_pair do |key, type|
246
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
247
+ self.send("#{key}=", nil)
248
+ elsif type =~ /\AArray<(.*)>/i
249
+ # check to ensure the input is an array given that the attribute
250
+ # is documented as an array but the input is not
251
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
252
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
253
+ end
254
+ elsif !attributes[self.class.attribute_map[key]].nil?
255
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
256
+ end
257
+ end
258
+
259
+ self
260
+ end
261
+
262
+ # Deserializes the data based on type
263
+ # @param string type Data type
264
+ # @param string value Value to be deserialized
265
+ # @return [Object] Deserialized data
266
+ def _deserialize(type, value)
267
+ case type.to_sym
268
+ when :Time
269
+ Time.parse(value)
270
+ when :Date
271
+ Date.parse(value)
272
+ when :String
273
+ value.to_s
274
+ when :Integer
275
+ value.to_i
276
+ when :Float
277
+ value.to_f
278
+ when :Boolean
279
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
280
+ true
281
+ else
282
+ false
283
+ end
284
+ when :Object
285
+ # generic object (usually a Hash), return directly
286
+ value
287
+ when /\AArray<(?<inner_type>.+)>\z/
288
+ inner_type = Regexp.last_match[:inner_type]
289
+ value.map { |v| _deserialize(inner_type, v) }
290
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
291
+ k_type = Regexp.last_match[:k_type]
292
+ v_type = Regexp.last_match[:v_type]
293
+ {}.tap do |hash|
294
+ value.each do |k, v|
295
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
296
+ end
297
+ end
298
+ else # model
299
+ # models (e.g. Pet) or oneOf
300
+ klass = UltracartClient.const_get(type)
301
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
302
+ end
303
+ end
304
+
305
+ # Returns the string representation of the object
306
+ # @return [String] String presentation of the object
307
+ def to_s
308
+ to_hash.to_s
309
+ end
310
+
311
+ # to_body is an alias to to_hash (backward compatibility)
312
+ # @return [Hash] Returns the object in the form of hash
313
+ def to_body
314
+ to_hash
315
+ end
316
+
317
+ # Returns the object in the form of hash
318
+ # @return [Hash] Returns the object in the form of hash
319
+ def to_hash
320
+ hash = {}
321
+ self.class.attribute_map.each_pair do |attr, param|
322
+ value = self.send(attr)
323
+ if value.nil?
324
+ is_nullable = self.class.openapi_nullable.include?(attr)
325
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
326
+ end
327
+
328
+ hash[param] = _to_hash(value)
329
+ end
330
+ hash
331
+ end
332
+
333
+ # Outputs non-array value in the form of hash
334
+ # For object, use to_hash. Otherwise, just return the value
335
+ # @param [Object] value Any valid value
336
+ # @return [Hash] Returns the value in the form of hash
337
+ def _to_hash(value)
338
+ if value.is_a?(Array)
339
+ value.compact.map { |v| _to_hash(v) }
340
+ elsif value.is_a?(Hash)
341
+ {}.tap do |hash|
342
+ value.each { |k, v| hash[k] = _to_hash(v) }
343
+ end
344
+ elsif value.respond_to? :to_hash
345
+ value.to_hash
346
+ else
347
+ value
348
+ end
349
+ end
350
+
351
+ end
352
+
353
+ end
@@ -0,0 +1,284 @@
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 ConversationAgentStatusRollupSearchRequest
18
+ # Optional agent_user_id filter
19
+ attr_accessor :agent_user_id
20
+
21
+ # Optional channel filter
22
+ attr_accessor :channel
23
+
24
+ # Date range end (YYYY-MM-DD)
25
+ attr_accessor :date_end
26
+
27
+ # Date range start (YYYY-MM-DD)
28
+ attr_accessor :date_start
29
+
30
+ class EnumAttributeValidator
31
+ attr_reader :datatype
32
+ attr_reader :allowable_values
33
+
34
+ def initialize(datatype, allowable_values)
35
+ @allowable_values = allowable_values.map do |value|
36
+ case datatype.to_s
37
+ when /Integer/i
38
+ value.to_i
39
+ when /Float/i
40
+ value.to_f
41
+ else
42
+ value
43
+ end
44
+ end
45
+ end
46
+
47
+ def valid?(value)
48
+ !value || allowable_values.include?(value)
49
+ end
50
+ end
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'agent_user_id' => :'agent_user_id',
56
+ :'channel' => :'channel',
57
+ :'date_end' => :'date_end',
58
+ :'date_start' => :'date_start'
59
+ }
60
+ end
61
+
62
+ # Returns all the JSON keys this model knows about
63
+ def self.acceptable_attributes
64
+ attribute_map.values
65
+ end
66
+
67
+ # Attribute type mapping.
68
+ def self.openapi_types
69
+ {
70
+ :'agent_user_id' => :'String',
71
+ :'channel' => :'String',
72
+ :'date_end' => :'String',
73
+ :'date_start' => :'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 `UltracartClient::ConversationAgentStatusRollupSearchRequest` 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 `UltracartClient::ConversationAgentStatusRollupSearchRequest`. 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?(:'agent_user_id')
99
+ self.agent_user_id = attributes[:'agent_user_id']
100
+ end
101
+
102
+ if attributes.key?(:'channel')
103
+ self.channel = attributes[:'channel']
104
+ end
105
+
106
+ if attributes.key?(:'date_end')
107
+ self.date_end = attributes[:'date_end']
108
+ end
109
+
110
+ if attributes.key?(:'date_start')
111
+ self.date_start = attributes[:'date_start']
112
+ end
113
+ end
114
+
115
+ # Show invalid properties with the reasons. Usually used together with valid?
116
+ # @return Array for valid properties with the reasons
117
+ def list_invalid_properties
118
+ invalid_properties = Array.new
119
+ invalid_properties
120
+ end
121
+
122
+ # Check to see if the all the properties in the model are valid
123
+ # @return true if the model is valid
124
+ def valid?
125
+ channel_validator = EnumAttributeValidator.new('String', ["pbx", "chat"])
126
+ return false unless channel_validator.valid?(@channel)
127
+ true
128
+ end
129
+
130
+ # Custom attribute writer method checking allowed values (enum).
131
+ # @param [Object] channel Object to be assigned
132
+ def channel=(channel)
133
+ validator = EnumAttributeValidator.new('String', ["pbx", "chat"])
134
+ unless validator.valid?(channel)
135
+ fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}."
136
+ end
137
+ @channel = channel
138
+ end
139
+
140
+ # Checks equality by comparing each attribute.
141
+ # @param [Object] Object to be compared
142
+ def ==(o)
143
+ return true if self.equal?(o)
144
+ self.class == o.class &&
145
+ agent_user_id == o.agent_user_id &&
146
+ channel == o.channel &&
147
+ date_end == o.date_end &&
148
+ date_start == o.date_start
149
+ end
150
+
151
+ # @see the `==` method
152
+ # @param [Object] Object to be compared
153
+ def eql?(o)
154
+ self == o
155
+ end
156
+
157
+ # Calculates hash code according to all attributes.
158
+ # @return [Integer] Hash code
159
+ def hash
160
+ [agent_user_id, channel, date_end, date_start].hash
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def self.build_from_hash(attributes)
167
+ new.build_from_hash(attributes)
168
+ end
169
+
170
+ # Builds the object from hash
171
+ # @param [Hash] attributes Model attributes in the form of hash
172
+ # @return [Object] Returns the model itself
173
+ def build_from_hash(attributes)
174
+ return nil unless attributes.is_a?(Hash)
175
+ attributes = attributes.transform_keys(&:to_sym)
176
+ self.class.openapi_types.each_pair do |key, type|
177
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
178
+ self.send("#{key}=", nil)
179
+ elsif type =~ /\AArray<(.*)>/i
180
+ # check to ensure the input is an array given that the attribute
181
+ # is documented as an array but the input is not
182
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
183
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
184
+ end
185
+ elsif !attributes[self.class.attribute_map[key]].nil?
186
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
187
+ end
188
+ end
189
+
190
+ self
191
+ end
192
+
193
+ # Deserializes the data based on type
194
+ # @param string type Data type
195
+ # @param string value Value to be deserialized
196
+ # @return [Object] Deserialized data
197
+ def _deserialize(type, value)
198
+ case type.to_sym
199
+ when :Time
200
+ Time.parse(value)
201
+ when :Date
202
+ Date.parse(value)
203
+ when :String
204
+ value.to_s
205
+ when :Integer
206
+ value.to_i
207
+ when :Float
208
+ value.to_f
209
+ when :Boolean
210
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
211
+ true
212
+ else
213
+ false
214
+ end
215
+ when :Object
216
+ # generic object (usually a Hash), return directly
217
+ value
218
+ when /\AArray<(?<inner_type>.+)>\z/
219
+ inner_type = Regexp.last_match[:inner_type]
220
+ value.map { |v| _deserialize(inner_type, v) }
221
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
222
+ k_type = Regexp.last_match[:k_type]
223
+ v_type = Regexp.last_match[:v_type]
224
+ {}.tap do |hash|
225
+ value.each do |k, v|
226
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
227
+ end
228
+ end
229
+ else # model
230
+ # models (e.g. Pet) or oneOf
231
+ klass = UltracartClient.const_get(type)
232
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
233
+ end
234
+ end
235
+
236
+ # Returns the string representation of the object
237
+ # @return [String] String presentation of the object
238
+ def to_s
239
+ to_hash.to_s
240
+ end
241
+
242
+ # to_body is an alias to to_hash (backward compatibility)
243
+ # @return [Hash] Returns the object in the form of hash
244
+ def to_body
245
+ to_hash
246
+ end
247
+
248
+ # Returns the object in the form of hash
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_hash
251
+ hash = {}
252
+ self.class.attribute_map.each_pair do |attr, param|
253
+ value = self.send(attr)
254
+ if value.nil?
255
+ is_nullable = self.class.openapi_nullable.include?(attr)
256
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
257
+ end
258
+
259
+ hash[param] = _to_hash(value)
260
+ end
261
+ hash
262
+ end
263
+
264
+ # Outputs non-array value in the form of hash
265
+ # For object, use to_hash. Otherwise, just return the value
266
+ # @param [Object] value Any valid value
267
+ # @return [Hash] Returns the value in the form of hash
268
+ def _to_hash(value)
269
+ if value.is_a?(Array)
270
+ value.compact.map { |v| _to_hash(v) }
271
+ elsif value.is_a?(Hash)
272
+ {}.tap do |hash|
273
+ value.each { |k, v| hash[k] = _to_hash(v) }
274
+ end
275
+ elsif value.respond_to? :to_hash
276
+ value.to_hash
277
+ else
278
+ value
279
+ end
280
+ end
281
+
282
+ end
283
+
284
+ end