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,461 @@
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 ConversationAgentStatusConfig
18
+ # Whether the status is active and selectable. DELETE soft-deactivates by setting this to false.
19
+ attr_accessor :active
20
+
21
+ # Channel this status applies to
22
+ attr_accessor :channel
23
+
24
+ # Hex color for UI (e.g. '#FF5733')
25
+ attr_accessor :color
26
+
27
+ # Conversation agent status unique identifier
28
+ attr_accessor :conversation_status_uuid
29
+
30
+ # Created at
31
+ attr_accessor :created_at
32
+
33
+ # Icon name
34
+ attr_accessor :icon
35
+
36
+ # Merchant Id
37
+ attr_accessor :merchant_id
38
+
39
+ # Display name shown to agents
40
+ attr_accessor :name
41
+
42
+ # Channel-native parent status
43
+ attr_accessor :parent_status
44
+
45
+ # Canonical routing semantic. Derived server-side from (channel, parent_status).
46
+ attr_accessor :routing_effect
47
+
48
+ # Sort order in lists; lower = first
49
+ attr_accessor :sort_order
50
+
51
+ # Twilio TaskRouter Activity SID (PBX-only; null for chat-only statuses)
52
+ attr_accessor :twilio_activity_sid
53
+
54
+ # Updated at
55
+ attr_accessor :updated_at
56
+
57
+ class EnumAttributeValidator
58
+ attr_reader :datatype
59
+ attr_reader :allowable_values
60
+
61
+ def initialize(datatype, allowable_values)
62
+ @allowable_values = allowable_values.map do |value|
63
+ case datatype.to_s
64
+ when /Integer/i
65
+ value.to_i
66
+ when /Float/i
67
+ value.to_f
68
+ else
69
+ value
70
+ end
71
+ end
72
+ end
73
+
74
+ def valid?(value)
75
+ !value || allowable_values.include?(value)
76
+ end
77
+ end
78
+
79
+ # Attribute mapping from ruby-style variable name to JSON key.
80
+ def self.attribute_map
81
+ {
82
+ :'active' => :'active',
83
+ :'channel' => :'channel',
84
+ :'color' => :'color',
85
+ :'conversation_status_uuid' => :'conversation_status_uuid',
86
+ :'created_at' => :'created_at',
87
+ :'icon' => :'icon',
88
+ :'merchant_id' => :'merchant_id',
89
+ :'name' => :'name',
90
+ :'parent_status' => :'parent_status',
91
+ :'routing_effect' => :'routing_effect',
92
+ :'sort_order' => :'sort_order',
93
+ :'twilio_activity_sid' => :'twilio_activity_sid',
94
+ :'updated_at' => :'updated_at'
95
+ }
96
+ end
97
+
98
+ # Returns all the JSON keys this model knows about
99
+ def self.acceptable_attributes
100
+ attribute_map.values
101
+ end
102
+
103
+ # Attribute type mapping.
104
+ def self.openapi_types
105
+ {
106
+ :'active' => :'Boolean',
107
+ :'channel' => :'String',
108
+ :'color' => :'String',
109
+ :'conversation_status_uuid' => :'String',
110
+ :'created_at' => :'String',
111
+ :'icon' => :'String',
112
+ :'merchant_id' => :'String',
113
+ :'name' => :'String',
114
+ :'parent_status' => :'String',
115
+ :'routing_effect' => :'String',
116
+ :'sort_order' => :'Integer',
117
+ :'twilio_activity_sid' => :'String',
118
+ :'updated_at' => :'String'
119
+ }
120
+ end
121
+
122
+ # List of attributes with nullable: true
123
+ def self.openapi_nullable
124
+ Set.new([
125
+ ])
126
+ end
127
+
128
+ # Initializes the object
129
+ # @param [Hash] attributes Model attributes in the form of hash
130
+ def initialize(attributes = {})
131
+ if (!attributes.is_a?(Hash))
132
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ConversationAgentStatusConfig` initialize method"
133
+ end
134
+
135
+ # check to see if the attribute exists and convert string to symbol for hash key
136
+ attributes = attributes.each_with_object({}) { |(k, v), h|
137
+ if (!self.class.attribute_map.key?(k.to_sym))
138
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ConversationAgentStatusConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
139
+ end
140
+ h[k.to_sym] = v
141
+ }
142
+
143
+ if attributes.key?(:'active')
144
+ self.active = attributes[:'active']
145
+ end
146
+
147
+ if attributes.key?(:'channel')
148
+ self.channel = attributes[:'channel']
149
+ end
150
+
151
+ if attributes.key?(:'color')
152
+ self.color = attributes[:'color']
153
+ end
154
+
155
+ if attributes.key?(:'conversation_status_uuid')
156
+ self.conversation_status_uuid = attributes[:'conversation_status_uuid']
157
+ end
158
+
159
+ if attributes.key?(:'created_at')
160
+ self.created_at = attributes[:'created_at']
161
+ end
162
+
163
+ if attributes.key?(:'icon')
164
+ self.icon = attributes[:'icon']
165
+ end
166
+
167
+ if attributes.key?(:'merchant_id')
168
+ self.merchant_id = attributes[:'merchant_id']
169
+ end
170
+
171
+ if attributes.key?(:'name')
172
+ self.name = attributes[:'name']
173
+ end
174
+
175
+ if attributes.key?(:'parent_status')
176
+ self.parent_status = attributes[:'parent_status']
177
+ end
178
+
179
+ if attributes.key?(:'routing_effect')
180
+ self.routing_effect = attributes[:'routing_effect']
181
+ end
182
+
183
+ if attributes.key?(:'sort_order')
184
+ self.sort_order = attributes[:'sort_order']
185
+ end
186
+
187
+ if attributes.key?(:'twilio_activity_sid')
188
+ self.twilio_activity_sid = attributes[:'twilio_activity_sid']
189
+ end
190
+
191
+ if attributes.key?(:'updated_at')
192
+ self.updated_at = attributes[:'updated_at']
193
+ end
194
+ end
195
+
196
+ # Show invalid properties with the reasons. Usually used together with valid?
197
+ # @return Array for valid properties with the reasons
198
+ def list_invalid_properties
199
+ invalid_properties = Array.new
200
+ if !@color.nil? && @color.to_s.length > 7
201
+ invalid_properties.push('invalid value for "color", the character length must be smaller than or equal to 7.')
202
+ end
203
+
204
+ if !@icon.nil? && @icon.to_s.length > 40
205
+ invalid_properties.push('invalid value for "icon", the character length must be smaller than or equal to 40.')
206
+ end
207
+
208
+ if !@merchant_id.nil? && @merchant_id.to_s.length > 5
209
+ invalid_properties.push('invalid value for "merchant_id", the character length must be smaller than or equal to 5.')
210
+ end
211
+
212
+ if !@name.nil? && @name.to_s.length > 100
213
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 100.')
214
+ end
215
+
216
+ if !@twilio_activity_sid.nil? && @twilio_activity_sid.to_s.length > 40
217
+ invalid_properties.push('invalid value for "twilio_activity_sid", the character length must be smaller than or equal to 40.')
218
+ end
219
+
220
+ invalid_properties
221
+ end
222
+
223
+ # Check to see if the all the properties in the model are valid
224
+ # @return true if the model is valid
225
+ def valid?
226
+ channel_validator = EnumAttributeValidator.new('String', ["pbx", "chat", "both"])
227
+ return false unless channel_validator.valid?(@channel)
228
+ return false if !@color.nil? && @color.to_s.length > 7
229
+ return false if !@icon.nil? && @icon.to_s.length > 40
230
+ return false if !@merchant_id.nil? && @merchant_id.to_s.length > 5
231
+ return false if !@name.nil? && @name.to_s.length > 100
232
+ routing_effect_validator = EnumAttributeValidator.new('String', ["available", "busy", "unavailable"])
233
+ return false unless routing_effect_validator.valid?(@routing_effect)
234
+ return false if !@twilio_activity_sid.nil? && @twilio_activity_sid.to_s.length > 40
235
+ true
236
+ end
237
+
238
+ # Custom attribute writer method checking allowed values (enum).
239
+ # @param [Object] channel Object to be assigned
240
+ def channel=(channel)
241
+ validator = EnumAttributeValidator.new('String', ["pbx", "chat", "both"])
242
+ unless validator.valid?(channel)
243
+ fail ArgumentError, "invalid value for \"channel\", must be one of #{validator.allowable_values}."
244
+ end
245
+ @channel = channel
246
+ end
247
+
248
+ # Custom attribute writer method with validation
249
+ # @param [Object] color Value to be assigned
250
+ def color=(color)
251
+ if !color.nil? && color.to_s.length > 7
252
+ fail ArgumentError, 'invalid value for "color", the character length must be smaller than or equal to 7.'
253
+ end
254
+
255
+ @color = color
256
+ end
257
+
258
+ # Custom attribute writer method with validation
259
+ # @param [Object] icon Value to be assigned
260
+ def icon=(icon)
261
+ if !icon.nil? && icon.to_s.length > 40
262
+ fail ArgumentError, 'invalid value for "icon", the character length must be smaller than or equal to 40.'
263
+ end
264
+
265
+ @icon = icon
266
+ end
267
+
268
+ # Custom attribute writer method with validation
269
+ # @param [Object] merchant_id Value to be assigned
270
+ def merchant_id=(merchant_id)
271
+ if !merchant_id.nil? && merchant_id.to_s.length > 5
272
+ fail ArgumentError, 'invalid value for "merchant_id", the character length must be smaller than or equal to 5.'
273
+ end
274
+
275
+ @merchant_id = merchant_id
276
+ end
277
+
278
+ # Custom attribute writer method with validation
279
+ # @param [Object] name Value to be assigned
280
+ def name=(name)
281
+ if !name.nil? && name.to_s.length > 100
282
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 100.'
283
+ end
284
+
285
+ @name = name
286
+ end
287
+
288
+ # Custom attribute writer method checking allowed values (enum).
289
+ # @param [Object] routing_effect Object to be assigned
290
+ def routing_effect=(routing_effect)
291
+ validator = EnumAttributeValidator.new('String', ["available", "busy", "unavailable"])
292
+ unless validator.valid?(routing_effect)
293
+ fail ArgumentError, "invalid value for \"routing_effect\", must be one of #{validator.allowable_values}."
294
+ end
295
+ @routing_effect = routing_effect
296
+ end
297
+
298
+ # Custom attribute writer method with validation
299
+ # @param [Object] twilio_activity_sid Value to be assigned
300
+ def twilio_activity_sid=(twilio_activity_sid)
301
+ if !twilio_activity_sid.nil? && twilio_activity_sid.to_s.length > 40
302
+ fail ArgumentError, 'invalid value for "twilio_activity_sid", the character length must be smaller than or equal to 40.'
303
+ end
304
+
305
+ @twilio_activity_sid = twilio_activity_sid
306
+ end
307
+
308
+ # Checks equality by comparing each attribute.
309
+ # @param [Object] Object to be compared
310
+ def ==(o)
311
+ return true if self.equal?(o)
312
+ self.class == o.class &&
313
+ active == o.active &&
314
+ channel == o.channel &&
315
+ color == o.color &&
316
+ conversation_status_uuid == o.conversation_status_uuid &&
317
+ created_at == o.created_at &&
318
+ icon == o.icon &&
319
+ merchant_id == o.merchant_id &&
320
+ name == o.name &&
321
+ parent_status == o.parent_status &&
322
+ routing_effect == o.routing_effect &&
323
+ sort_order == o.sort_order &&
324
+ twilio_activity_sid == o.twilio_activity_sid &&
325
+ updated_at == o.updated_at
326
+ end
327
+
328
+ # @see the `==` method
329
+ # @param [Object] Object to be compared
330
+ def eql?(o)
331
+ self == o
332
+ end
333
+
334
+ # Calculates hash code according to all attributes.
335
+ # @return [Integer] Hash code
336
+ def hash
337
+ [active, channel, color, conversation_status_uuid, created_at, icon, merchant_id, name, parent_status, routing_effect, sort_order, twilio_activity_sid, updated_at].hash
338
+ end
339
+
340
+ # Builds the object from hash
341
+ # @param [Hash] attributes Model attributes in the form of hash
342
+ # @return [Object] Returns the model itself
343
+ def self.build_from_hash(attributes)
344
+ new.build_from_hash(attributes)
345
+ end
346
+
347
+ # Builds the object from hash
348
+ # @param [Hash] attributes Model attributes in the form of hash
349
+ # @return [Object] Returns the model itself
350
+ def build_from_hash(attributes)
351
+ return nil unless attributes.is_a?(Hash)
352
+ attributes = attributes.transform_keys(&:to_sym)
353
+ self.class.openapi_types.each_pair do |key, type|
354
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
355
+ self.send("#{key}=", nil)
356
+ elsif type =~ /\AArray<(.*)>/i
357
+ # check to ensure the input is an array given that the attribute
358
+ # is documented as an array but the input is not
359
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
360
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
361
+ end
362
+ elsif !attributes[self.class.attribute_map[key]].nil?
363
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
364
+ end
365
+ end
366
+
367
+ self
368
+ end
369
+
370
+ # Deserializes the data based on type
371
+ # @param string type Data type
372
+ # @param string value Value to be deserialized
373
+ # @return [Object] Deserialized data
374
+ def _deserialize(type, value)
375
+ case type.to_sym
376
+ when :Time
377
+ Time.parse(value)
378
+ when :Date
379
+ Date.parse(value)
380
+ when :String
381
+ value.to_s
382
+ when :Integer
383
+ value.to_i
384
+ when :Float
385
+ value.to_f
386
+ when :Boolean
387
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
388
+ true
389
+ else
390
+ false
391
+ end
392
+ when :Object
393
+ # generic object (usually a Hash), return directly
394
+ value
395
+ when /\AArray<(?<inner_type>.+)>\z/
396
+ inner_type = Regexp.last_match[:inner_type]
397
+ value.map { |v| _deserialize(inner_type, v) }
398
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
399
+ k_type = Regexp.last_match[:k_type]
400
+ v_type = Regexp.last_match[:v_type]
401
+ {}.tap do |hash|
402
+ value.each do |k, v|
403
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
404
+ end
405
+ end
406
+ else # model
407
+ # models (e.g. Pet) or oneOf
408
+ klass = UltracartClient.const_get(type)
409
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
410
+ end
411
+ end
412
+
413
+ # Returns the string representation of the object
414
+ # @return [String] String presentation of the object
415
+ def to_s
416
+ to_hash.to_s
417
+ end
418
+
419
+ # to_body is an alias to to_hash (backward compatibility)
420
+ # @return [Hash] Returns the object in the form of hash
421
+ def to_body
422
+ to_hash
423
+ end
424
+
425
+ # Returns the object in the form of hash
426
+ # @return [Hash] Returns the object in the form of hash
427
+ def to_hash
428
+ hash = {}
429
+ self.class.attribute_map.each_pair do |attr, param|
430
+ value = self.send(attr)
431
+ if value.nil?
432
+ is_nullable = self.class.openapi_nullable.include?(attr)
433
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
434
+ end
435
+
436
+ hash[param] = _to_hash(value)
437
+ end
438
+ hash
439
+ end
440
+
441
+ # Outputs non-array value in the form of hash
442
+ # For object, use to_hash. Otherwise, just return the value
443
+ # @param [Object] value Any valid value
444
+ # @return [Hash] Returns the value in the form of hash
445
+ def _to_hash(value)
446
+ if value.is_a?(Array)
447
+ value.compact.map { |v| _to_hash(v) }
448
+ elsif value.is_a?(Hash)
449
+ {}.tap do |hash|
450
+ value.each { |k, v| hash[k] = _to_hash(v) }
451
+ end
452
+ elsif value.respond_to? :to_hash
453
+ value.to_hash
454
+ else
455
+ value
456
+ end
457
+ end
458
+
459
+ end
460
+
461
+ end
@@ -0,0 +1,256 @@
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 ConversationAgentStatusConfigResponse
18
+ attr_accessor :error
19
+
20
+ attr_accessor :metadata
21
+
22
+ attr_accessor :status_config
23
+
24
+ # Indicates if API call was successful
25
+ attr_accessor :success
26
+
27
+ attr_accessor :warning
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'error' => :'error',
33
+ :'metadata' => :'metadata',
34
+ :'status_config' => :'status_config',
35
+ :'success' => :'success',
36
+ :'warning' => :'warning'
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'error' => :'Error',
49
+ :'metadata' => :'ResponseMetadata',
50
+ :'status_config' => :'ConversationAgentStatusConfig',
51
+ :'success' => :'Boolean',
52
+ :'warning' => :'Warning'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ConversationAgentStatusConfigResponse` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ConversationAgentStatusConfigResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'error')
78
+ self.error = attributes[:'error']
79
+ end
80
+
81
+ if attributes.key?(:'metadata')
82
+ self.metadata = attributes[:'metadata']
83
+ end
84
+
85
+ if attributes.key?(:'status_config')
86
+ self.status_config = attributes[:'status_config']
87
+ end
88
+
89
+ if attributes.key?(:'success')
90
+ self.success = attributes[:'success']
91
+ end
92
+
93
+ if attributes.key?(:'warning')
94
+ self.warning = attributes[:'warning']
95
+ end
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properties with the reasons
100
+ def list_invalid_properties
101
+ invalid_properties = Array.new
102
+ invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ true
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ error == o.error &&
117
+ metadata == o.metadata &&
118
+ status_config == o.status_config &&
119
+ success == o.success &&
120
+ warning == o.warning
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Integer] Hash code
131
+ def hash
132
+ [error, metadata, status_config, success, warning].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def self.build_from_hash(attributes)
139
+ new.build_from_hash(attributes)
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ attributes = attributes.transform_keys(&:to_sym)
148
+ self.class.openapi_types.each_pair do |key, type|
149
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
150
+ self.send("#{key}=", nil)
151
+ elsif type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the attribute
153
+ # is documented as an array but the input is not
154
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
155
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
156
+ end
157
+ elsif !attributes[self.class.attribute_map[key]].nil?
158
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
159
+ end
160
+ end
161
+
162
+ self
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def _deserialize(type, value)
170
+ case type.to_sym
171
+ when :Time
172
+ Time.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :Boolean
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ # models (e.g. Pet) or oneOf
203
+ klass = UltracartClient.const_get(type)
204
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+
254
+ end
255
+
256
+ end