ultracart_api 4.0.201 → 4.0.202

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +80 -4
  3. data/docs/ConversationApi.md +3565 -549
  4. data/docs/ConversationPbxAgent.md +34 -0
  5. data/docs/ConversationPbxAgentResponse.md +26 -0
  6. data/docs/ConversationPbxAgentsResponse.md +26 -0
  7. data/docs/ConversationPbxAudio.md +34 -0
  8. data/docs/ConversationPbxAudioResponse.md +26 -0
  9. data/docs/ConversationPbxAudiosResponse.md +26 -0
  10. data/docs/ConversationPbxCustomerSnapshotRequest.md +32 -0
  11. data/docs/ConversationPbxCustomerSnapshotResponse.md +30 -0
  12. data/docs/ConversationPbxMenu.md +36 -0
  13. data/docs/ConversationPbxMenuMapping.md +24 -0
  14. data/docs/ConversationPbxMenuResponse.md +26 -0
  15. data/docs/ConversationPbxMenusResponse.md +26 -0
  16. data/docs/ConversationPbxPhoneNumber.md +26 -0
  17. data/docs/ConversationPbxPhoneNumberResponse.md +26 -0
  18. data/docs/ConversationPbxPhoneNumbersResponse.md +26 -0
  19. data/docs/ConversationPbxQueue.md +52 -0
  20. data/docs/ConversationPbxQueueMembers.md +20 -0
  21. data/docs/ConversationPbxQueueResponse.md +26 -0
  22. data/docs/ConversationPbxQueuesResponse.md +26 -0
  23. data/docs/ConversationPbxTimeBased.md +24 -0
  24. data/docs/ConversationPbxTimeBasedMapping.md +24 -0
  25. data/docs/ConversationPbxTimeBasedMappingConfig.md +20 -0
  26. data/docs/ConversationPbxTimeBasedResponse.md +26 -0
  27. data/docs/ConversationPbxTimeBasedsResponse.md +26 -0
  28. data/docs/ConversationPbxTimeRange.md +26 -0
  29. data/docs/ConversationPbxTimeRangeConfig.md +28 -0
  30. data/docs/ConversationPbxTimeRangeResponse.md +26 -0
  31. data/docs/ConversationPbxTimeRangesResponse.md +26 -0
  32. data/docs/ConversationPbxVoicemailMailbox.md +38 -0
  33. data/docs/ConversationPbxVoicemailMailboxResponse.md +26 -0
  34. data/docs/ConversationPbxVoicemailMailboxesResponse.md +26 -0
  35. data/docs/WorkflowApi.md +69 -0
  36. data/docs/WorkflowTaskTagsResponse.md +26 -0
  37. data/lib/ultracart_api/api/conversation_api.rb +3422 -649
  38. data/lib/ultracart_api/api/workflow_api.rb +58 -0
  39. data/lib/ultracart_api/models/conversation_pbx_agent.rb +360 -0
  40. data/lib/ultracart_api/models/conversation_pbx_agent_response.rb +256 -0
  41. data/lib/ultracart_api/models/conversation_pbx_agents_response.rb +258 -0
  42. data/lib/ultracart_api/models/conversation_pbx_audio.rb +390 -0
  43. data/lib/ultracart_api/models/conversation_pbx_audio_response.rb +256 -0
  44. data/lib/ultracart_api/models/conversation_pbx_audios_response.rb +258 -0
  45. data/lib/ultracart_api/models/conversation_pbx_customer_snapshot_request.rb +283 -0
  46. data/lib/ultracart_api/models/conversation_pbx_customer_snapshot_response.rb +278 -0
  47. data/lib/ultracart_api/models/conversation_pbx_menu.rb +402 -0
  48. data/lib/ultracart_api/models/conversation_pbx_menu_mapping.rb +250 -0
  49. data/lib/ultracart_api/models/conversation_pbx_menu_response.rb +256 -0
  50. data/lib/ultracart_api/models/conversation_pbx_menus_response.rb +258 -0
  51. data/lib/ultracart_api/models/conversation_pbx_phone_number.rb +335 -0
  52. data/lib/ultracart_api/models/conversation_pbx_phone_number_response.rb +256 -0
  53. data/lib/ultracart_api/models/conversation_pbx_phone_numbers_response.rb +258 -0
  54. data/lib/ultracart_api/models/conversation_pbx_queue.rb +539 -0
  55. data/lib/ultracart_api/models/conversation_pbx_queue_members.rb +232 -0
  56. data/lib/ultracart_api/models/conversation_pbx_queue_response.rb +256 -0
  57. data/lib/ultracart_api/models/conversation_pbx_queues_response.rb +258 -0
  58. data/lib/ultracart_api/models/conversation_pbx_time_based.rb +246 -0
  59. data/lib/ultracart_api/models/conversation_pbx_time_based_mapping.rb +310 -0
  60. data/lib/ultracart_api/models/conversation_pbx_time_based_mapping_config.rb +231 -0
  61. data/lib/ultracart_api/models/conversation_pbx_time_based_response.rb +256 -0
  62. data/lib/ultracart_api/models/conversation_pbx_time_baseds_response.rb +258 -0
  63. data/lib/ultracart_api/models/conversation_pbx_time_range.rb +322 -0
  64. data/lib/ultracart_api/models/conversation_pbx_time_range_config.rb +270 -0
  65. data/lib/ultracart_api/models/conversation_pbx_time_range_response.rb +256 -0
  66. data/lib/ultracart_api/models/conversation_pbx_time_ranges_response.rb +258 -0
  67. data/lib/ultracart_api/models/conversation_pbx_voicemail_mailbox.rb +440 -0
  68. data/lib/ultracart_api/models/conversation_pbx_voicemail_mailbox_response.rb +256 -0
  69. data/lib/ultracart_api/models/conversation_pbx_voicemail_mailboxes_response.rb +258 -0
  70. data/lib/ultracart_api/models/workflow_task_tags_response.rb +259 -0
  71. data/lib/ultracart_api/version.rb +1 -1
  72. data/lib/ultracart_api.rb +32 -0
  73. metadata +66 -2
@@ -0,0 +1,322 @@
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 ConversationPbxTimeRange
18
+ # Configurations for all ranges in this time range
19
+ attr_accessor :configs
20
+
21
+ # Conversation Pbx Time Range UUID
22
+ attr_accessor :conversation_pbx_time_range_uuid
23
+
24
+ # Merchant Id
25
+ attr_accessor :merchant_id
26
+
27
+ # Time range name
28
+ attr_accessor :time_range_name
29
+
30
+ # Timezone
31
+ attr_accessor :timezone
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'configs' => :'configs',
37
+ :'conversation_pbx_time_range_uuid' => :'conversation_pbx_time_range_uuid',
38
+ :'merchant_id' => :'merchant_id',
39
+ :'time_range_name' => :'time_range_name',
40
+ :'timezone' => :'timezone'
41
+ }
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'configs' => :'Array<ConversationPbxTimeRangeConfig>',
53
+ :'conversation_pbx_time_range_uuid' => :'String',
54
+ :'merchant_id' => :'String',
55
+ :'time_range_name' => :'String',
56
+ :'timezone' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ConversationPbxTimeRange` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!self.class.attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ConversationPbxTimeRange`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'configs')
82
+ if (value = attributes[:'configs']).is_a?(Array)
83
+ self.configs = value
84
+ end
85
+ end
86
+
87
+ if attributes.key?(:'conversation_pbx_time_range_uuid')
88
+ self.conversation_pbx_time_range_uuid = attributes[:'conversation_pbx_time_range_uuid']
89
+ end
90
+
91
+ if attributes.key?(:'merchant_id')
92
+ self.merchant_id = attributes[:'merchant_id']
93
+ end
94
+
95
+ if attributes.key?(:'time_range_name')
96
+ self.time_range_name = attributes[:'time_range_name']
97
+ end
98
+
99
+ if attributes.key?(:'timezone')
100
+ self.timezone = attributes[:'timezone']
101
+ end
102
+ end
103
+
104
+ # Show invalid properties with the reasons. Usually used together with valid?
105
+ # @return Array for valid properties with the reasons
106
+ def list_invalid_properties
107
+ invalid_properties = Array.new
108
+ if !@conversation_pbx_time_range_uuid.nil? && @conversation_pbx_time_range_uuid.to_s.length > 50
109
+ invalid_properties.push('invalid value for "conversation_pbx_time_range_uuid", the character length must be smaller than or equal to 50.')
110
+ end
111
+
112
+ if !@merchant_id.nil? && @merchant_id.to_s.length > 5
113
+ invalid_properties.push('invalid value for "merchant_id", the character length must be smaller than or equal to 5.')
114
+ end
115
+
116
+ if !@time_range_name.nil? && @time_range_name.to_s.length > 50
117
+ invalid_properties.push('invalid value for "time_range_name", the character length must be smaller than or equal to 50.')
118
+ end
119
+
120
+ if !@timezone.nil? && @timezone.to_s.length > 100
121
+ invalid_properties.push('invalid value for "timezone", the character length must be smaller than or equal to 100.')
122
+ end
123
+
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ return false if !@conversation_pbx_time_range_uuid.nil? && @conversation_pbx_time_range_uuid.to_s.length > 50
131
+ return false if !@merchant_id.nil? && @merchant_id.to_s.length > 5
132
+ return false if !@time_range_name.nil? && @time_range_name.to_s.length > 50
133
+ return false if !@timezone.nil? && @timezone.to_s.length > 100
134
+ true
135
+ end
136
+
137
+ # Custom attribute writer method with validation
138
+ # @param [Object] conversation_pbx_time_range_uuid Value to be assigned
139
+ def conversation_pbx_time_range_uuid=(conversation_pbx_time_range_uuid)
140
+ if !conversation_pbx_time_range_uuid.nil? && conversation_pbx_time_range_uuid.to_s.length > 50
141
+ fail ArgumentError, 'invalid value for "conversation_pbx_time_range_uuid", the character length must be smaller than or equal to 50.'
142
+ end
143
+
144
+ @conversation_pbx_time_range_uuid = conversation_pbx_time_range_uuid
145
+ end
146
+
147
+ # Custom attribute writer method with validation
148
+ # @param [Object] merchant_id Value to be assigned
149
+ def merchant_id=(merchant_id)
150
+ if !merchant_id.nil? && merchant_id.to_s.length > 5
151
+ fail ArgumentError, 'invalid value for "merchant_id", the character length must be smaller than or equal to 5.'
152
+ end
153
+
154
+ @merchant_id = merchant_id
155
+ end
156
+
157
+ # Custom attribute writer method with validation
158
+ # @param [Object] time_range_name Value to be assigned
159
+ def time_range_name=(time_range_name)
160
+ if !time_range_name.nil? && time_range_name.to_s.length > 50
161
+ fail ArgumentError, 'invalid value for "time_range_name", the character length must be smaller than or equal to 50.'
162
+ end
163
+
164
+ @time_range_name = time_range_name
165
+ end
166
+
167
+ # Custom attribute writer method with validation
168
+ # @param [Object] timezone Value to be assigned
169
+ def timezone=(timezone)
170
+ if !timezone.nil? && timezone.to_s.length > 100
171
+ fail ArgumentError, 'invalid value for "timezone", the character length must be smaller than or equal to 100.'
172
+ end
173
+
174
+ @timezone = timezone
175
+ end
176
+
177
+ # Checks equality by comparing each attribute.
178
+ # @param [Object] Object to be compared
179
+ def ==(o)
180
+ return true if self.equal?(o)
181
+ self.class == o.class &&
182
+ configs == o.configs &&
183
+ conversation_pbx_time_range_uuid == o.conversation_pbx_time_range_uuid &&
184
+ merchant_id == o.merchant_id &&
185
+ time_range_name == o.time_range_name &&
186
+ timezone == o.timezone
187
+ end
188
+
189
+ # @see the `==` method
190
+ # @param [Object] Object to be compared
191
+ def eql?(o)
192
+ self == o
193
+ end
194
+
195
+ # Calculates hash code according to all attributes.
196
+ # @return [Integer] Hash code
197
+ def hash
198
+ [configs, conversation_pbx_time_range_uuid, merchant_id, time_range_name, timezone].hash
199
+ end
200
+
201
+ # Builds the object from hash
202
+ # @param [Hash] attributes Model attributes in the form of hash
203
+ # @return [Object] Returns the model itself
204
+ def self.build_from_hash(attributes)
205
+ new.build_from_hash(attributes)
206
+ end
207
+
208
+ # Builds the object from hash
209
+ # @param [Hash] attributes Model attributes in the form of hash
210
+ # @return [Object] Returns the model itself
211
+ def build_from_hash(attributes)
212
+ return nil unless attributes.is_a?(Hash)
213
+ attributes = attributes.transform_keys(&:to_sym)
214
+ self.class.openapi_types.each_pair do |key, type|
215
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
216
+ self.send("#{key}=", nil)
217
+ elsif type =~ /\AArray<(.*)>/i
218
+ # check to ensure the input is an array given that the attribute
219
+ # is documented as an array but the input is not
220
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
221
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
222
+ end
223
+ elsif !attributes[self.class.attribute_map[key]].nil?
224
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
225
+ end
226
+ end
227
+
228
+ self
229
+ end
230
+
231
+ # Deserializes the data based on type
232
+ # @param string type Data type
233
+ # @param string value Value to be deserialized
234
+ # @return [Object] Deserialized data
235
+ def _deserialize(type, value)
236
+ case type.to_sym
237
+ when :Time
238
+ Time.parse(value)
239
+ when :Date
240
+ Date.parse(value)
241
+ when :String
242
+ value.to_s
243
+ when :Integer
244
+ value.to_i
245
+ when :Float
246
+ value.to_f
247
+ when :Boolean
248
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
249
+ true
250
+ else
251
+ false
252
+ end
253
+ when :Object
254
+ # generic object (usually a Hash), return directly
255
+ value
256
+ when /\AArray<(?<inner_type>.+)>\z/
257
+ inner_type = Regexp.last_match[:inner_type]
258
+ value.map { |v| _deserialize(inner_type, v) }
259
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
260
+ k_type = Regexp.last_match[:k_type]
261
+ v_type = Regexp.last_match[:v_type]
262
+ {}.tap do |hash|
263
+ value.each do |k, v|
264
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
265
+ end
266
+ end
267
+ else # model
268
+ # models (e.g. Pet) or oneOf
269
+ klass = UltracartClient.const_get(type)
270
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
271
+ end
272
+ end
273
+
274
+ # Returns the string representation of the object
275
+ # @return [String] String presentation of the object
276
+ def to_s
277
+ to_hash.to_s
278
+ end
279
+
280
+ # to_body is an alias to to_hash (backward compatibility)
281
+ # @return [Hash] Returns the object in the form of hash
282
+ def to_body
283
+ to_hash
284
+ end
285
+
286
+ # Returns the object in the form of hash
287
+ # @return [Hash] Returns the object in the form of hash
288
+ def to_hash
289
+ hash = {}
290
+ self.class.attribute_map.each_pair do |attr, param|
291
+ value = self.send(attr)
292
+ if value.nil?
293
+ is_nullable = self.class.openapi_nullable.include?(attr)
294
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
295
+ end
296
+
297
+ hash[param] = _to_hash(value)
298
+ end
299
+ hash
300
+ end
301
+
302
+ # Outputs non-array value in the form of hash
303
+ # For object, use to_hash. Otherwise, just return the value
304
+ # @param [Object] value Any valid value
305
+ # @return [Hash] Returns the value in the form of hash
306
+ def _to_hash(value)
307
+ if value.is_a?(Array)
308
+ value.compact.map { |v| _to_hash(v) }
309
+ elsif value.is_a?(Hash)
310
+ {}.tap do |hash|
311
+ value.each { |k, v| hash[k] = _to_hash(v) }
312
+ end
313
+ elsif value.respond_to? :to_hash
314
+ value.to_hash
315
+ else
316
+ value
317
+ end
318
+ end
319
+
320
+ end
321
+
322
+ end
@@ -0,0 +1,270 @@
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 ConversationPbxTimeRangeConfig
18
+ # End date
19
+ attr_accessor :end_date
20
+
21
+ # End day of week
22
+ attr_accessor :end_day_of_week
23
+
24
+ # End time
25
+ attr_accessor :end_time
26
+
27
+ # Start date
28
+ attr_accessor :start_date
29
+
30
+ # Start day of week
31
+ attr_accessor :start_day_of_week
32
+
33
+ # Start time
34
+ attr_accessor :start_time
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'end_date' => :'end_date',
40
+ :'end_day_of_week' => :'end_day_of_week',
41
+ :'end_time' => :'end_time',
42
+ :'start_date' => :'start_date',
43
+ :'start_day_of_week' => :'start_day_of_week',
44
+ :'start_time' => :'start_time'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'end_date' => :'String',
57
+ :'end_day_of_week' => :'Integer',
58
+ :'end_time' => :'String',
59
+ :'start_date' => :'String',
60
+ :'start_day_of_week' => :'Integer',
61
+ :'start_time' => :'String'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ConversationPbxTimeRangeConfig` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ConversationPbxTimeRangeConfig`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'end_date')
87
+ self.end_date = attributes[:'end_date']
88
+ end
89
+
90
+ if attributes.key?(:'end_day_of_week')
91
+ self.end_day_of_week = attributes[:'end_day_of_week']
92
+ end
93
+
94
+ if attributes.key?(:'end_time')
95
+ self.end_time = attributes[:'end_time']
96
+ end
97
+
98
+ if attributes.key?(:'start_date')
99
+ self.start_date = attributes[:'start_date']
100
+ end
101
+
102
+ if attributes.key?(:'start_day_of_week')
103
+ self.start_day_of_week = attributes[:'start_day_of_week']
104
+ end
105
+
106
+ if attributes.key?(:'start_time')
107
+ self.start_time = attributes[:'start_time']
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ invalid_properties = Array.new
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ true
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ end_date == o.end_date &&
130
+ end_day_of_week == o.end_day_of_week &&
131
+ end_time == o.end_time &&
132
+ start_date == o.start_date &&
133
+ start_day_of_week == o.start_day_of_week &&
134
+ start_time == o.start_time
135
+ end
136
+
137
+ # @see the `==` method
138
+ # @param [Object] Object to be compared
139
+ def eql?(o)
140
+ self == o
141
+ end
142
+
143
+ # Calculates hash code according to all attributes.
144
+ # @return [Integer] Hash code
145
+ def hash
146
+ [end_date, end_day_of_week, end_time, start_date, start_day_of_week, start_time].hash
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def self.build_from_hash(attributes)
153
+ new.build_from_hash(attributes)
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def build_from_hash(attributes)
160
+ return nil unless attributes.is_a?(Hash)
161
+ attributes = attributes.transform_keys(&:to_sym)
162
+ self.class.openapi_types.each_pair do |key, type|
163
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
164
+ self.send("#{key}=", nil)
165
+ elsif type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
170
+ end
171
+ elsif !attributes[self.class.attribute_map[key]].nil?
172
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
173
+ end
174
+ end
175
+
176
+ self
177
+ end
178
+
179
+ # Deserializes the data based on type
180
+ # @param string type Data type
181
+ # @param string value Value to be deserialized
182
+ # @return [Object] Deserialized data
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :Time
186
+ Time.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :Boolean
196
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when :Object
202
+ # generic object (usually a Hash), return directly
203
+ value
204
+ when /\AArray<(?<inner_type>.+)>\z/
205
+ inner_type = Regexp.last_match[:inner_type]
206
+ value.map { |v| _deserialize(inner_type, v) }
207
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
208
+ k_type = Regexp.last_match[:k_type]
209
+ v_type = Regexp.last_match[:v_type]
210
+ {}.tap do |hash|
211
+ value.each do |k, v|
212
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
+ end
214
+ end
215
+ else # model
216
+ # models (e.g. Pet) or oneOf
217
+ klass = UltracartClient.const_get(type)
218
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
219
+ end
220
+ end
221
+
222
+ # Returns the string representation of the object
223
+ # @return [String] String presentation of the object
224
+ def to_s
225
+ to_hash.to_s
226
+ end
227
+
228
+ # to_body is an alias to to_hash (backward compatibility)
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_body
231
+ to_hash
232
+ end
233
+
234
+ # Returns the object in the form of hash
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_hash
237
+ hash = {}
238
+ self.class.attribute_map.each_pair do |attr, param|
239
+ value = self.send(attr)
240
+ if value.nil?
241
+ is_nullable = self.class.openapi_nullable.include?(attr)
242
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
243
+ end
244
+
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param [Object] value Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map { |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
266
+ end
267
+
268
+ end
269
+
270
+ end