ultracart_api 3.10.183 → 3.10.185

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +88 -4
  3. data/docs/ConversationApi.md +2466 -340
  4. data/docs/ConversationPbxAgent.md +16 -0
  5. data/docs/ConversationPbxAgentResponse.md +12 -0
  6. data/docs/ConversationPbxAgentsResponse.md +12 -0
  7. data/docs/ConversationPbxAudio.md +16 -0
  8. data/docs/ConversationPbxAudioResponse.md +12 -0
  9. data/docs/ConversationPbxAudiosResponse.md +12 -0
  10. data/docs/ConversationPbxCustomerSnapshotRequest.md +15 -0
  11. data/docs/ConversationPbxCustomerSnapshotResponse.md +14 -0
  12. data/docs/ConversationPbxMenu.md +17 -0
  13. data/docs/ConversationPbxMenuMapping.md +11 -0
  14. data/docs/ConversationPbxMenuResponse.md +12 -0
  15. data/docs/ConversationPbxMenusResponse.md +12 -0
  16. data/docs/ConversationPbxPhoneNumber.md +12 -0
  17. data/docs/ConversationPbxPhoneNumberResponse.md +12 -0
  18. data/docs/ConversationPbxPhoneNumbersResponse.md +12 -0
  19. data/docs/ConversationPbxQueue.md +25 -0
  20. data/docs/ConversationPbxQueueMembers.md +9 -0
  21. data/docs/ConversationPbxQueueResponse.md +12 -0
  22. data/docs/ConversationPbxQueuesResponse.md +12 -0
  23. data/docs/ConversationPbxTimeBased.md +11 -0
  24. data/docs/ConversationPbxTimeBasedMapping.md +11 -0
  25. data/docs/ConversationPbxTimeBasedMappingConfig.md +9 -0
  26. data/docs/ConversationPbxTimeBasedResponse.md +12 -0
  27. data/docs/ConversationPbxTimeBasedsResponse.md +12 -0
  28. data/docs/ConversationPbxTimeRange.md +12 -0
  29. data/docs/ConversationPbxTimeRangeConfig.md +13 -0
  30. data/docs/ConversationPbxTimeRangeResponse.md +12 -0
  31. data/docs/ConversationPbxTimeRangesResponse.md +12 -0
  32. data/docs/ConversationPbxVoicemailMailbox.md +18 -0
  33. data/docs/ConversationPbxVoicemailMailboxResponse.md +12 -0
  34. data/docs/ConversationPbxVoicemailMailboxesResponse.md +12 -0
  35. data/docs/EmailSmsOrder.md +11 -0
  36. data/docs/EmailSmsOrdersResponse.md +12 -0
  37. data/docs/EmailSmsStat.md +37 -0
  38. data/docs/EmailStatSmsSummaryRequest.md +9 -0
  39. data/docs/EmailStatSmsSummaryResponse.md +12 -0
  40. data/docs/PricingTier.md +1 -0
  41. data/docs/StorefrontApi.md +114 -0
  42. data/docs/WorkflowApi.md +46 -0
  43. data/docs/WorkflowTaskTagsResponse.md +12 -0
  44. data/lib/ultracart_api/api/conversation_api.rb +2919 -609
  45. data/lib/ultracart_api/api/storefront_api.rb +133 -0
  46. data/lib/ultracart_api/api/workflow_api.rb +49 -0
  47. data/lib/ultracart_api/models/conversation_pbx_agent.rb +325 -0
  48. data/lib/ultracart_api/models/conversation_pbx_agent_response.rb +221 -0
  49. data/lib/ultracart_api/models/conversation_pbx_agents_response.rb +223 -0
  50. data/lib/ultracart_api/models/conversation_pbx_audio.rb +355 -0
  51. data/lib/ultracart_api/models/conversation_pbx_audio_response.rb +221 -0
  52. data/lib/ultracart_api/models/conversation_pbx_audios_response.rb +223 -0
  53. data/lib/ultracart_api/models/conversation_pbx_customer_snapshot_request.rb +248 -0
  54. data/lib/ultracart_api/models/conversation_pbx_customer_snapshot_response.rb +243 -0
  55. data/lib/ultracart_api/models/conversation_pbx_menu.rb +367 -0
  56. data/lib/ultracart_api/models/conversation_pbx_menu_mapping.rb +215 -0
  57. data/lib/ultracart_api/models/conversation_pbx_menu_response.rb +221 -0
  58. data/lib/ultracart_api/models/conversation_pbx_menus_response.rb +223 -0
  59. data/lib/ultracart_api/models/conversation_pbx_phone_number.rb +300 -0
  60. data/lib/ultracart_api/models/conversation_pbx_phone_number_response.rb +221 -0
  61. data/lib/ultracart_api/models/conversation_pbx_phone_numbers_response.rb +223 -0
  62. data/lib/ultracart_api/models/conversation_pbx_queue.rb +504 -0
  63. data/lib/ultracart_api/models/conversation_pbx_queue_members.rb +197 -0
  64. data/lib/ultracart_api/models/conversation_pbx_queue_response.rb +221 -0
  65. data/lib/ultracart_api/models/conversation_pbx_queues_response.rb +223 -0
  66. data/lib/ultracart_api/models/conversation_pbx_time_based.rb +211 -0
  67. data/lib/ultracart_api/models/conversation_pbx_time_based_mapping.rb +275 -0
  68. data/lib/ultracart_api/models/conversation_pbx_time_based_mapping_config.rb +196 -0
  69. data/lib/ultracart_api/models/conversation_pbx_time_based_response.rb +221 -0
  70. data/lib/ultracart_api/models/conversation_pbx_time_baseds_response.rb +223 -0
  71. data/lib/ultracart_api/models/conversation_pbx_time_range.rb +287 -0
  72. data/lib/ultracart_api/models/conversation_pbx_time_range_config.rb +235 -0
  73. data/lib/ultracart_api/models/conversation_pbx_time_range_response.rb +221 -0
  74. data/lib/ultracart_api/models/conversation_pbx_time_ranges_response.rb +223 -0
  75. data/lib/ultracart_api/models/conversation_pbx_voicemail_mailbox.rb +405 -0
  76. data/lib/ultracart_api/models/conversation_pbx_voicemail_mailbox_response.rb +221 -0
  77. data/lib/ultracart_api/models/conversation_pbx_voicemail_mailboxes_response.rb +223 -0
  78. data/lib/ultracart_api/models/email_sms_order.rb +214 -0
  79. data/lib/ultracart_api/models/email_sms_orders_response.rb +223 -0
  80. data/lib/ultracart_api/models/email_sms_stat.rb +476 -0
  81. data/lib/ultracart_api/models/email_stat_sms_summary_request.rb +195 -0
  82. data/lib/ultracart_api/models/email_stat_sms_summary_response.rb +223 -0
  83. data/lib/ultracart_api/models/pricing_tier.rb +11 -1
  84. data/lib/ultracart_api/models/workflow_task_tags_response.rb +224 -0
  85. data/lib/ultracart_api/version.rb +1 -1
  86. data/lib/ultracart_api.rb +37 -0
  87. metadata +76 -2
@@ -0,0 +1,367 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class ConversationPbxMenu
17
+ # If true, the customer is allowed to input direct extensions within this menu
18
+ attr_accessor :allow_direct_extensions
19
+
20
+ # Conversation Pbx Menu UUID
21
+ attr_accessor :conversation_pbx_menu_uuid
22
+
23
+ # The default action for this menu
24
+ attr_accessor :default_action
25
+
26
+ # The default action target for this menu
27
+ attr_accessor :default_action_target
28
+
29
+ # Action mappings for this menu
30
+ attr_accessor :mappings
31
+
32
+ # Merchant Id
33
+ attr_accessor :merchant_id
34
+
35
+ # Menu name
36
+ attr_accessor :name
37
+
38
+ # An optional audio clip that plays when a customer enters this menu
39
+ attr_accessor :play_audio_uuid
40
+
41
+ # An optional saying that plays when a customer enters this menu
42
+ attr_accessor :say
43
+
44
+ # The idle seconds before this menu times out
45
+ attr_accessor :timeout
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'allow_direct_extensions' => :'allow_direct_extensions',
51
+ :'conversation_pbx_menu_uuid' => :'conversation_pbx_menu_uuid',
52
+ :'default_action' => :'default_action',
53
+ :'default_action_target' => :'default_action_target',
54
+ :'mappings' => :'mappings',
55
+ :'merchant_id' => :'merchant_id',
56
+ :'name' => :'name',
57
+ :'play_audio_uuid' => :'play_audio_uuid',
58
+ :'say' => :'say',
59
+ :'timeout' => :'timeout'
60
+ }
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.swagger_types
65
+ {
66
+ :'allow_direct_extensions' => :'BOOLEAN',
67
+ :'conversation_pbx_menu_uuid' => :'String',
68
+ :'default_action' => :'String',
69
+ :'default_action_target' => :'String',
70
+ :'mappings' => :'Array<ConversationPbxMenuMapping>',
71
+ :'merchant_id' => :'String',
72
+ :'name' => :'String',
73
+ :'play_audio_uuid' => :'String',
74
+ :'say' => :'String',
75
+ :'timeout' => :'Integer'
76
+ }
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ return unless attributes.is_a?(Hash)
83
+
84
+ # convert string to symbol for hash key
85
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
86
+
87
+ if attributes.has_key?(:'allow_direct_extensions')
88
+ self.allow_direct_extensions = attributes[:'allow_direct_extensions']
89
+ end
90
+
91
+ if attributes.has_key?(:'conversation_pbx_menu_uuid')
92
+ self.conversation_pbx_menu_uuid = attributes[:'conversation_pbx_menu_uuid']
93
+ end
94
+
95
+ if attributes.has_key?(:'default_action')
96
+ self.default_action = attributes[:'default_action']
97
+ end
98
+
99
+ if attributes.has_key?(:'default_action_target')
100
+ self.default_action_target = attributes[:'default_action_target']
101
+ end
102
+
103
+ if attributes.has_key?(:'mappings')
104
+ if (value = attributes[:'mappings']).is_a?(Array)
105
+ self.mappings = value
106
+ end
107
+ end
108
+
109
+ if attributes.has_key?(:'merchant_id')
110
+ self.merchant_id = attributes[:'merchant_id']
111
+ end
112
+
113
+ if attributes.has_key?(:'name')
114
+ self.name = attributes[:'name']
115
+ end
116
+
117
+ if attributes.has_key?(:'play_audio_uuid')
118
+ self.play_audio_uuid = attributes[:'play_audio_uuid']
119
+ end
120
+
121
+ if attributes.has_key?(:'say')
122
+ self.say = attributes[:'say']
123
+ end
124
+
125
+ if attributes.has_key?(:'timeout')
126
+ self.timeout = attributes[:'timeout']
127
+ end
128
+ end
129
+
130
+ # Show invalid properties with the reasons. Usually used together with valid?
131
+ # @return Array for valid properties with the reasons
132
+ def list_invalid_properties
133
+ invalid_properties = Array.new
134
+ if !@conversation_pbx_menu_uuid.nil? && @conversation_pbx_menu_uuid.to_s.length > 50
135
+ invalid_properties.push('invalid value for "conversation_pbx_menu_uuid", the character length must be smaller than or equal to 50.')
136
+ end
137
+
138
+ if !@default_action.nil? && @default_action.to_s.length > 30
139
+ invalid_properties.push('invalid value for "default_action", the character length must be smaller than or equal to 30.')
140
+ end
141
+
142
+ if !@default_action_target.nil? && @default_action_target.to_s.length > 50
143
+ invalid_properties.push('invalid value for "default_action_target", the character length must be smaller than or equal to 50.')
144
+ end
145
+
146
+ if !@merchant_id.nil? && @merchant_id.to_s.length > 5
147
+ invalid_properties.push('invalid value for "merchant_id", the character length must be smaller than or equal to 5.')
148
+ end
149
+
150
+ if !@name.nil? && @name.to_s.length > 50
151
+ invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 50.')
152
+ end
153
+
154
+ if !@play_audio_uuid.nil? && @play_audio_uuid.to_s.length > 50
155
+ invalid_properties.push('invalid value for "play_audio_uuid", the character length must be smaller than or equal to 50.')
156
+ end
157
+
158
+ invalid_properties
159
+ end
160
+
161
+ # Check to see if the all the properties in the model are valid
162
+ # @return true if the model is valid
163
+ def valid?
164
+ return false if !@conversation_pbx_menu_uuid.nil? && @conversation_pbx_menu_uuid.to_s.length > 50
165
+ return false if !@default_action.nil? && @default_action.to_s.length > 30
166
+ return false if !@default_action_target.nil? && @default_action_target.to_s.length > 50
167
+ return false if !@merchant_id.nil? && @merchant_id.to_s.length > 5
168
+ return false if !@name.nil? && @name.to_s.length > 50
169
+ return false if !@play_audio_uuid.nil? && @play_audio_uuid.to_s.length > 50
170
+ true
171
+ end
172
+
173
+ # Custom attribute writer method with validation
174
+ # @param [Object] conversation_pbx_menu_uuid Value to be assigned
175
+ def conversation_pbx_menu_uuid=(conversation_pbx_menu_uuid)
176
+ if !conversation_pbx_menu_uuid.nil? && conversation_pbx_menu_uuid.to_s.length > 50
177
+ fail ArgumentError, 'invalid value for "conversation_pbx_menu_uuid", the character length must be smaller than or equal to 50.'
178
+ end
179
+
180
+ @conversation_pbx_menu_uuid = conversation_pbx_menu_uuid
181
+ end
182
+
183
+ # Custom attribute writer method with validation
184
+ # @param [Object] default_action Value to be assigned
185
+ def default_action=(default_action)
186
+ if !default_action.nil? && default_action.to_s.length > 30
187
+ fail ArgumentError, 'invalid value for "default_action", the character length must be smaller than or equal to 30.'
188
+ end
189
+
190
+ @default_action = default_action
191
+ end
192
+
193
+ # Custom attribute writer method with validation
194
+ # @param [Object] default_action_target Value to be assigned
195
+ def default_action_target=(default_action_target)
196
+ if !default_action_target.nil? && default_action_target.to_s.length > 50
197
+ fail ArgumentError, 'invalid value for "default_action_target", the character length must be smaller than or equal to 50.'
198
+ end
199
+
200
+ @default_action_target = default_action_target
201
+ end
202
+
203
+ # Custom attribute writer method with validation
204
+ # @param [Object] merchant_id Value to be assigned
205
+ def merchant_id=(merchant_id)
206
+ if !merchant_id.nil? && merchant_id.to_s.length > 5
207
+ fail ArgumentError, 'invalid value for "merchant_id", the character length must be smaller than or equal to 5.'
208
+ end
209
+
210
+ @merchant_id = merchant_id
211
+ end
212
+
213
+ # Custom attribute writer method with validation
214
+ # @param [Object] name Value to be assigned
215
+ def name=(name)
216
+ if !name.nil? && name.to_s.length > 50
217
+ fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 50.'
218
+ end
219
+
220
+ @name = name
221
+ end
222
+
223
+ # Custom attribute writer method with validation
224
+ # @param [Object] play_audio_uuid Value to be assigned
225
+ def play_audio_uuid=(play_audio_uuid)
226
+ if !play_audio_uuid.nil? && play_audio_uuid.to_s.length > 50
227
+ fail ArgumentError, 'invalid value for "play_audio_uuid", the character length must be smaller than or equal to 50.'
228
+ end
229
+
230
+ @play_audio_uuid = play_audio_uuid
231
+ end
232
+
233
+ # Checks equality by comparing each attribute.
234
+ # @param [Object] Object to be compared
235
+ def ==(o)
236
+ return true if self.equal?(o)
237
+ self.class == o.class &&
238
+ allow_direct_extensions == o.allow_direct_extensions &&
239
+ conversation_pbx_menu_uuid == o.conversation_pbx_menu_uuid &&
240
+ default_action == o.default_action &&
241
+ default_action_target == o.default_action_target &&
242
+ mappings == o.mappings &&
243
+ merchant_id == o.merchant_id &&
244
+ name == o.name &&
245
+ play_audio_uuid == o.play_audio_uuid &&
246
+ say == o.say &&
247
+ timeout == o.timeout
248
+ end
249
+
250
+ # @see the `==` method
251
+ # @param [Object] Object to be compared
252
+ def eql?(o)
253
+ self == o
254
+ end
255
+
256
+ # Calculates hash code according to all attributes.
257
+ # @return [Fixnum] Hash code
258
+ def hash
259
+ [allow_direct_extensions, conversation_pbx_menu_uuid, default_action, default_action_target, mappings, merchant_id, name, play_audio_uuid, say, timeout].hash
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
+ self.class.swagger_types.each_pair do |key, type|
268
+ if type =~ /\AArray<(.*)>/i
269
+ # check to ensure the input is an array given that the attribute
270
+ # is documented as an array but the input is not
271
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
272
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
273
+ end
274
+ elsif !attributes[self.class.attribute_map[key]].nil?
275
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
276
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
277
+ end
278
+
279
+ self
280
+ end
281
+
282
+ # Deserializes the data based on type
283
+ # @param string type Data type
284
+ # @param string value Value to be deserialized
285
+ # @return [Object] Deserialized data
286
+ def _deserialize(type, value)
287
+ case type.to_sym
288
+ when :DateTime
289
+ DateTime.parse(value)
290
+ when :Date
291
+ Date.parse(value)
292
+ when :String
293
+ value.to_s
294
+ when :Integer
295
+ value.to_i
296
+ when :Float
297
+ value.to_f
298
+ when :BOOLEAN
299
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
300
+ true
301
+ else
302
+ false
303
+ end
304
+ when :Object
305
+ # generic object (usually a Hash), return directly
306
+ value
307
+ when /\AArray<(?<inner_type>.+)>\z/
308
+ inner_type = Regexp.last_match[:inner_type]
309
+ value.map { |v| _deserialize(inner_type, v) }
310
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
311
+ k_type = Regexp.last_match[:k_type]
312
+ v_type = Regexp.last_match[:v_type]
313
+ {}.tap do |hash|
314
+ value.each do |k, v|
315
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
316
+ end
317
+ end
318
+ else # model
319
+ temp_model = UltracartClient.const_get(type).new
320
+ temp_model.build_from_hash(value)
321
+ end
322
+ end
323
+
324
+ # Returns the string representation of the object
325
+ # @return [String] String presentation of the object
326
+ def to_s
327
+ to_hash.to_s
328
+ end
329
+
330
+ # to_body is an alias to to_hash (backward compatibility)
331
+ # @return [Hash] Returns the object in the form of hash
332
+ def to_body
333
+ to_hash
334
+ end
335
+
336
+ # Returns the object in the form of hash
337
+ # @return [Hash] Returns the object in the form of hash
338
+ def to_hash
339
+ hash = {}
340
+ self.class.attribute_map.each_pair do |attr, param|
341
+ value = self.send(attr)
342
+ next if value.nil?
343
+ hash[param] = _to_hash(value)
344
+ end
345
+ hash
346
+ end
347
+
348
+ # Outputs non-array value in the form of hash
349
+ # For object, use to_hash. Otherwise, just return the value
350
+ # @param [Object] value Any valid value
351
+ # @return [Hash] Returns the value in the form of hash
352
+ def _to_hash(value)
353
+ if value.is_a?(Array)
354
+ value.compact.map { |v| _to_hash(v) }
355
+ elsif value.is_a?(Hash)
356
+ {}.tap do |hash|
357
+ value.each { |k, v| hash[k] = _to_hash(v) }
358
+ end
359
+ elsif value.respond_to? :to_hash
360
+ value.to_hash
361
+ else
362
+ value
363
+ end
364
+ end
365
+
366
+ end
367
+ end
@@ -0,0 +1,215 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ OpenAPI spec version: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.15-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module UltracartClient
16
+ class ConversationPbxMenuMapping
17
+ # Action
18
+ attr_accessor :action
19
+
20
+ # Action target
21
+ attr_accessor :action_target
22
+
23
+ # Digits
24
+ attr_accessor :digits
25
+
26
+ # Speech
27
+ attr_accessor :speech
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'action' => :'action',
33
+ :'action_target' => :'action_target',
34
+ :'digits' => :'digits',
35
+ :'speech' => :'speech'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.swagger_types
41
+ {
42
+ :'action' => :'String',
43
+ :'action_target' => :'String',
44
+ :'digits' => :'Integer',
45
+ :'speech' => :'String'
46
+ }
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ return unless attributes.is_a?(Hash)
53
+
54
+ # convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
56
+
57
+ if attributes.has_key?(:'action')
58
+ self.action = attributes[:'action']
59
+ end
60
+
61
+ if attributes.has_key?(:'action_target')
62
+ self.action_target = attributes[:'action_target']
63
+ end
64
+
65
+ if attributes.has_key?(:'digits')
66
+ self.digits = attributes[:'digits']
67
+ end
68
+
69
+ if attributes.has_key?(:'speech')
70
+ self.speech = attributes[:'speech']
71
+ end
72
+ end
73
+
74
+ # Show invalid properties with the reasons. Usually used together with valid?
75
+ # @return Array for valid properties with the reasons
76
+ def list_invalid_properties
77
+ invalid_properties = Array.new
78
+ invalid_properties
79
+ end
80
+
81
+ # Check to see if the all the properties in the model are valid
82
+ # @return true if the model is valid
83
+ def valid?
84
+ true
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] Object to be compared
89
+ def ==(o)
90
+ return true if self.equal?(o)
91
+ self.class == o.class &&
92
+ action == o.action &&
93
+ action_target == o.action_target &&
94
+ digits == o.digits &&
95
+ speech == o.speech
96
+ end
97
+
98
+ # @see the `==` method
99
+ # @param [Object] Object to be compared
100
+ def eql?(o)
101
+ self == o
102
+ end
103
+
104
+ # Calculates hash code according to all attributes.
105
+ # @return [Fixnum] Hash code
106
+ def hash
107
+ [action, action_target, digits, speech].hash
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.swagger_types.each_pair do |key, type|
116
+ if type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :DateTime
137
+ DateTime.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :BOOLEAN
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ temp_model = UltracartClient.const_get(type).new
168
+ temp_model.build_from_hash(value)
169
+ end
170
+ end
171
+
172
+ # Returns the string representation of the object
173
+ # @return [String] String presentation of the object
174
+ def to_s
175
+ to_hash.to_s
176
+ end
177
+
178
+ # to_body is an alias to to_hash (backward compatibility)
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_body
181
+ to_hash
182
+ end
183
+
184
+ # Returns the object in the form of hash
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_hash
187
+ hash = {}
188
+ self.class.attribute_map.each_pair do |attr, param|
189
+ value = self.send(attr)
190
+ next if value.nil?
191
+ hash[param] = _to_hash(value)
192
+ end
193
+ hash
194
+ end
195
+
196
+ # Outputs non-array value in the form of hash
197
+ # For object, use to_hash. Otherwise, just return the value
198
+ # @param [Object] value Any valid value
199
+ # @return [Hash] Returns the value in the form of hash
200
+ def _to_hash(value)
201
+ if value.is_a?(Array)
202
+ value.compact.map { |v| _to_hash(v) }
203
+ elsif value.is_a?(Hash)
204
+ {}.tap do |hash|
205
+ value.each { |k, v| hash[k] = _to_hash(v) }
206
+ end
207
+ elsif value.respond_to? :to_hash
208
+ value.to_hash
209
+ else
210
+ value
211
+ end
212
+ end
213
+
214
+ end
215
+ end