ultracart_api 3.10.184 → 3.10.185

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 +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/WorkflowApi.md +46 -0
  36. data/docs/WorkflowTaskTagsResponse.md +12 -0
  37. data/lib/ultracart_api/api/conversation_api.rb +2919 -609
  38. data/lib/ultracart_api/api/workflow_api.rb +49 -0
  39. data/lib/ultracart_api/models/conversation_pbx_agent.rb +325 -0
  40. data/lib/ultracart_api/models/conversation_pbx_agent_response.rb +221 -0
  41. data/lib/ultracart_api/models/conversation_pbx_agents_response.rb +223 -0
  42. data/lib/ultracart_api/models/conversation_pbx_audio.rb +355 -0
  43. data/lib/ultracart_api/models/conversation_pbx_audio_response.rb +221 -0
  44. data/lib/ultracart_api/models/conversation_pbx_audios_response.rb +223 -0
  45. data/lib/ultracart_api/models/conversation_pbx_customer_snapshot_request.rb +248 -0
  46. data/lib/ultracart_api/models/conversation_pbx_customer_snapshot_response.rb +243 -0
  47. data/lib/ultracart_api/models/conversation_pbx_menu.rb +367 -0
  48. data/lib/ultracart_api/models/conversation_pbx_menu_mapping.rb +215 -0
  49. data/lib/ultracart_api/models/conversation_pbx_menu_response.rb +221 -0
  50. data/lib/ultracart_api/models/conversation_pbx_menus_response.rb +223 -0
  51. data/lib/ultracart_api/models/conversation_pbx_phone_number.rb +300 -0
  52. data/lib/ultracart_api/models/conversation_pbx_phone_number_response.rb +221 -0
  53. data/lib/ultracart_api/models/conversation_pbx_phone_numbers_response.rb +223 -0
  54. data/lib/ultracart_api/models/conversation_pbx_queue.rb +504 -0
  55. data/lib/ultracart_api/models/conversation_pbx_queue_members.rb +197 -0
  56. data/lib/ultracart_api/models/conversation_pbx_queue_response.rb +221 -0
  57. data/lib/ultracart_api/models/conversation_pbx_queues_response.rb +223 -0
  58. data/lib/ultracart_api/models/conversation_pbx_time_based.rb +211 -0
  59. data/lib/ultracart_api/models/conversation_pbx_time_based_mapping.rb +275 -0
  60. data/lib/ultracart_api/models/conversation_pbx_time_based_mapping_config.rb +196 -0
  61. data/lib/ultracart_api/models/conversation_pbx_time_based_response.rb +221 -0
  62. data/lib/ultracart_api/models/conversation_pbx_time_baseds_response.rb +223 -0
  63. data/lib/ultracart_api/models/conversation_pbx_time_range.rb +287 -0
  64. data/lib/ultracart_api/models/conversation_pbx_time_range_config.rb +235 -0
  65. data/lib/ultracart_api/models/conversation_pbx_time_range_response.rb +221 -0
  66. data/lib/ultracart_api/models/conversation_pbx_time_ranges_response.rb +223 -0
  67. data/lib/ultracart_api/models/conversation_pbx_voicemail_mailbox.rb +405 -0
  68. data/lib/ultracart_api/models/conversation_pbx_voicemail_mailbox_response.rb +221 -0
  69. data/lib/ultracart_api/models/conversation_pbx_voicemail_mailboxes_response.rb +223 -0
  70. data/lib/ultracart_api/models/workflow_task_tags_response.rb +224 -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,223 @@
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 ConversationPbxAgentsResponse
17
+ attr_accessor :agents
18
+
19
+ attr_accessor :error
20
+
21
+ attr_accessor :metadata
22
+
23
+ # Indicates if API call was successful
24
+ attr_accessor :success
25
+
26
+ attr_accessor :warning
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'agents' => :'agents',
32
+ :'error' => :'error',
33
+ :'metadata' => :'metadata',
34
+ :'success' => :'success',
35
+ :'warning' => :'warning'
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.swagger_types
41
+ {
42
+ :'agents' => :'Array<ConversationPbxAgent>',
43
+ :'error' => :'Error',
44
+ :'metadata' => :'ResponseMetadata',
45
+ :'success' => :'BOOLEAN',
46
+ :'warning' => :'Warning'
47
+ }
48
+ end
49
+
50
+ # Initializes the object
51
+ # @param [Hash] attributes Model attributes in the form of hash
52
+ def initialize(attributes = {})
53
+ return unless attributes.is_a?(Hash)
54
+
55
+ # convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
57
+
58
+ if attributes.has_key?(:'agents')
59
+ if (value = attributes[:'agents']).is_a?(Array)
60
+ self.agents = value
61
+ end
62
+ end
63
+
64
+ if attributes.has_key?(:'error')
65
+ self.error = attributes[:'error']
66
+ end
67
+
68
+ if attributes.has_key?(:'metadata')
69
+ self.metadata = attributes[:'metadata']
70
+ end
71
+
72
+ if attributes.has_key?(:'success')
73
+ self.success = attributes[:'success']
74
+ end
75
+
76
+ if attributes.has_key?(:'warning')
77
+ self.warning = attributes[:'warning']
78
+ end
79
+ end
80
+
81
+ # Show invalid properties with the reasons. Usually used together with valid?
82
+ # @return Array for valid properties with the reasons
83
+ def list_invalid_properties
84
+ invalid_properties = Array.new
85
+ invalid_properties
86
+ end
87
+
88
+ # Check to see if the all the properties in the model are valid
89
+ # @return true if the model is valid
90
+ def valid?
91
+ true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ agents == o.agents &&
100
+ error == o.error &&
101
+ metadata == o.metadata &&
102
+ success == o.success &&
103
+ warning == o.warning
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Fixnum] Hash code
114
+ def hash
115
+ [agents, error, metadata, success, warning].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.swagger_types.each_pair do |key, type|
124
+ if type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :DateTime
145
+ DateTime.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :BOOLEAN
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ temp_model = UltracartClient.const_get(type).new
176
+ temp_model.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ next if value.nil?
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map { |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+
222
+ end
223
+ end
@@ -0,0 +1,355 @@
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 ConversationPbxAudio
17
+ # Audio S3 Listing Key
18
+ attr_accessor :audio_s3_listing_key
19
+
20
+ # Conversation Pbx Audio UUID
21
+ attr_accessor :conversation_pbx_audio_uuid
22
+
23
+ # If true, this will be the default hold music
24
+ attr_accessor :default_hold_music
25
+
26
+ # Description of this audio
27
+ attr_accessor :description
28
+
29
+ # Filename
30
+ attr_accessor :filename
31
+
32
+ # Merchant Id
33
+ attr_accessor :merchant_id
34
+
35
+ # Mime Type
36
+ attr_accessor :mime_type
37
+
38
+ # User Id
39
+ attr_accessor :user_id
40
+
41
+ # Version
42
+ attr_accessor :version
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'audio_s3_listing_key' => :'audio_s3_listing_key',
48
+ :'conversation_pbx_audio_uuid' => :'conversation_pbx_audio_uuid',
49
+ :'default_hold_music' => :'default_hold_music',
50
+ :'description' => :'description',
51
+ :'filename' => :'filename',
52
+ :'merchant_id' => :'merchant_id',
53
+ :'mime_type' => :'mime_type',
54
+ :'user_id' => :'user_id',
55
+ :'version' => :'version'
56
+ }
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.swagger_types
61
+ {
62
+ :'audio_s3_listing_key' => :'String',
63
+ :'conversation_pbx_audio_uuid' => :'String',
64
+ :'default_hold_music' => :'BOOLEAN',
65
+ :'description' => :'String',
66
+ :'filename' => :'String',
67
+ :'merchant_id' => :'String',
68
+ :'mime_type' => :'String',
69
+ :'user_id' => :'Integer',
70
+ :'version' => :'Integer'
71
+ }
72
+ end
73
+
74
+ # Initializes the object
75
+ # @param [Hash] attributes Model attributes in the form of hash
76
+ def initialize(attributes = {})
77
+ return unless attributes.is_a?(Hash)
78
+
79
+ # convert string to symbol for hash key
80
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
81
+
82
+ if attributes.has_key?(:'audio_s3_listing_key')
83
+ self.audio_s3_listing_key = attributes[:'audio_s3_listing_key']
84
+ end
85
+
86
+ if attributes.has_key?(:'conversation_pbx_audio_uuid')
87
+ self.conversation_pbx_audio_uuid = attributes[:'conversation_pbx_audio_uuid']
88
+ end
89
+
90
+ if attributes.has_key?(:'default_hold_music')
91
+ self.default_hold_music = attributes[:'default_hold_music']
92
+ end
93
+
94
+ if attributes.has_key?(:'description')
95
+ self.description = attributes[:'description']
96
+ end
97
+
98
+ if attributes.has_key?(:'filename')
99
+ self.filename = attributes[:'filename']
100
+ end
101
+
102
+ if attributes.has_key?(:'merchant_id')
103
+ self.merchant_id = attributes[:'merchant_id']
104
+ end
105
+
106
+ if attributes.has_key?(:'mime_type')
107
+ self.mime_type = attributes[:'mime_type']
108
+ end
109
+
110
+ if attributes.has_key?(:'user_id')
111
+ self.user_id = attributes[:'user_id']
112
+ end
113
+
114
+ if attributes.has_key?(:'version')
115
+ self.version = attributes[:'version']
116
+ end
117
+ end
118
+
119
+ # Show invalid properties with the reasons. Usually used together with valid?
120
+ # @return Array for valid properties with the reasons
121
+ def list_invalid_properties
122
+ invalid_properties = Array.new
123
+ if !@audio_s3_listing_key.nil? && @audio_s3_listing_key.to_s.length > 250
124
+ invalid_properties.push('invalid value for "audio_s3_listing_key", the character length must be smaller than or equal to 250.')
125
+ end
126
+
127
+ if !@conversation_pbx_audio_uuid.nil? && @conversation_pbx_audio_uuid.to_s.length > 50
128
+ invalid_properties.push('invalid value for "conversation_pbx_audio_uuid", the character length must be smaller than or equal to 50.')
129
+ end
130
+
131
+ if !@description.nil? && @description.to_s.length > 100
132
+ invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 100.')
133
+ end
134
+
135
+ if !@filename.nil? && @filename.to_s.length > 100
136
+ invalid_properties.push('invalid value for "filename", the character length must be smaller than or equal to 100.')
137
+ end
138
+
139
+ if !@merchant_id.nil? && @merchant_id.to_s.length > 5
140
+ invalid_properties.push('invalid value for "merchant_id", the character length must be smaller than or equal to 5.')
141
+ end
142
+
143
+ if !@mime_type.nil? && @mime_type.to_s.length > 100
144
+ invalid_properties.push('invalid value for "mime_type", the character length must be smaller than or equal to 100.')
145
+ end
146
+
147
+ invalid_properties
148
+ end
149
+
150
+ # Check to see if the all the properties in the model are valid
151
+ # @return true if the model is valid
152
+ def valid?
153
+ return false if !@audio_s3_listing_key.nil? && @audio_s3_listing_key.to_s.length > 250
154
+ return false if !@conversation_pbx_audio_uuid.nil? && @conversation_pbx_audio_uuid.to_s.length > 50
155
+ return false if !@description.nil? && @description.to_s.length > 100
156
+ return false if !@filename.nil? && @filename.to_s.length > 100
157
+ return false if !@merchant_id.nil? && @merchant_id.to_s.length > 5
158
+ return false if !@mime_type.nil? && @mime_type.to_s.length > 100
159
+ true
160
+ end
161
+
162
+ # Custom attribute writer method with validation
163
+ # @param [Object] audio_s3_listing_key Value to be assigned
164
+ def audio_s3_listing_key=(audio_s3_listing_key)
165
+ if !audio_s3_listing_key.nil? && audio_s3_listing_key.to_s.length > 250
166
+ fail ArgumentError, 'invalid value for "audio_s3_listing_key", the character length must be smaller than or equal to 250.'
167
+ end
168
+
169
+ @audio_s3_listing_key = audio_s3_listing_key
170
+ end
171
+
172
+ # Custom attribute writer method with validation
173
+ # @param [Object] conversation_pbx_audio_uuid Value to be assigned
174
+ def conversation_pbx_audio_uuid=(conversation_pbx_audio_uuid)
175
+ if !conversation_pbx_audio_uuid.nil? && conversation_pbx_audio_uuid.to_s.length > 50
176
+ fail ArgumentError, 'invalid value for "conversation_pbx_audio_uuid", the character length must be smaller than or equal to 50.'
177
+ end
178
+
179
+ @conversation_pbx_audio_uuid = conversation_pbx_audio_uuid
180
+ end
181
+
182
+ # Custom attribute writer method with validation
183
+ # @param [Object] description Value to be assigned
184
+ def description=(description)
185
+ if !description.nil? && description.to_s.length > 100
186
+ fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 100.'
187
+ end
188
+
189
+ @description = description
190
+ end
191
+
192
+ # Custom attribute writer method with validation
193
+ # @param [Object] filename Value to be assigned
194
+ def filename=(filename)
195
+ if !filename.nil? && filename.to_s.length > 100
196
+ fail ArgumentError, 'invalid value for "filename", the character length must be smaller than or equal to 100.'
197
+ end
198
+
199
+ @filename = filename
200
+ end
201
+
202
+ # Custom attribute writer method with validation
203
+ # @param [Object] merchant_id Value to be assigned
204
+ def merchant_id=(merchant_id)
205
+ if !merchant_id.nil? && merchant_id.to_s.length > 5
206
+ fail ArgumentError, 'invalid value for "merchant_id", the character length must be smaller than or equal to 5.'
207
+ end
208
+
209
+ @merchant_id = merchant_id
210
+ end
211
+
212
+ # Custom attribute writer method with validation
213
+ # @param [Object] mime_type Value to be assigned
214
+ def mime_type=(mime_type)
215
+ if !mime_type.nil? && mime_type.to_s.length > 100
216
+ fail ArgumentError, 'invalid value for "mime_type", the character length must be smaller than or equal to 100.'
217
+ end
218
+
219
+ @mime_type = mime_type
220
+ end
221
+
222
+ # Checks equality by comparing each attribute.
223
+ # @param [Object] Object to be compared
224
+ def ==(o)
225
+ return true if self.equal?(o)
226
+ self.class == o.class &&
227
+ audio_s3_listing_key == o.audio_s3_listing_key &&
228
+ conversation_pbx_audio_uuid == o.conversation_pbx_audio_uuid &&
229
+ default_hold_music == o.default_hold_music &&
230
+ description == o.description &&
231
+ filename == o.filename &&
232
+ merchant_id == o.merchant_id &&
233
+ mime_type == o.mime_type &&
234
+ user_id == o.user_id &&
235
+ version == o.version
236
+ end
237
+
238
+ # @see the `==` method
239
+ # @param [Object] Object to be compared
240
+ def eql?(o)
241
+ self == o
242
+ end
243
+
244
+ # Calculates hash code according to all attributes.
245
+ # @return [Fixnum] Hash code
246
+ def hash
247
+ [audio_s3_listing_key, conversation_pbx_audio_uuid, default_hold_music, description, filename, merchant_id, mime_type, user_id, version].hash
248
+ end
249
+
250
+ # Builds the object from hash
251
+ # @param [Hash] attributes Model attributes in the form of hash
252
+ # @return [Object] Returns the model itself
253
+ def build_from_hash(attributes)
254
+ return nil unless attributes.is_a?(Hash)
255
+ self.class.swagger_types.each_pair do |key, type|
256
+ if type =~ /\AArray<(.*)>/i
257
+ # check to ensure the input is an array given that the attribute
258
+ # is documented as an array but the input is not
259
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
260
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
261
+ end
262
+ elsif !attributes[self.class.attribute_map[key]].nil?
263
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
264
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
265
+ end
266
+
267
+ self
268
+ end
269
+
270
+ # Deserializes the data based on type
271
+ # @param string type Data type
272
+ # @param string value Value to be deserialized
273
+ # @return [Object] Deserialized data
274
+ def _deserialize(type, value)
275
+ case type.to_sym
276
+ when :DateTime
277
+ DateTime.parse(value)
278
+ when :Date
279
+ Date.parse(value)
280
+ when :String
281
+ value.to_s
282
+ when :Integer
283
+ value.to_i
284
+ when :Float
285
+ value.to_f
286
+ when :BOOLEAN
287
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
288
+ true
289
+ else
290
+ false
291
+ end
292
+ when :Object
293
+ # generic object (usually a Hash), return directly
294
+ value
295
+ when /\AArray<(?<inner_type>.+)>\z/
296
+ inner_type = Regexp.last_match[:inner_type]
297
+ value.map { |v| _deserialize(inner_type, v) }
298
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
299
+ k_type = Regexp.last_match[:k_type]
300
+ v_type = Regexp.last_match[:v_type]
301
+ {}.tap do |hash|
302
+ value.each do |k, v|
303
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
304
+ end
305
+ end
306
+ else # model
307
+ temp_model = UltracartClient.const_get(type).new
308
+ temp_model.build_from_hash(value)
309
+ end
310
+ end
311
+
312
+ # Returns the string representation of the object
313
+ # @return [String] String presentation of the object
314
+ def to_s
315
+ to_hash.to_s
316
+ end
317
+
318
+ # to_body is an alias to to_hash (backward compatibility)
319
+ # @return [Hash] Returns the object in the form of hash
320
+ def to_body
321
+ to_hash
322
+ end
323
+
324
+ # Returns the object in the form of hash
325
+ # @return [Hash] Returns the object in the form of hash
326
+ def to_hash
327
+ hash = {}
328
+ self.class.attribute_map.each_pair do |attr, param|
329
+ value = self.send(attr)
330
+ next if value.nil?
331
+ hash[param] = _to_hash(value)
332
+ end
333
+ hash
334
+ end
335
+
336
+ # Outputs non-array value in the form of hash
337
+ # For object, use to_hash. Otherwise, just return the value
338
+ # @param [Object] value Any valid value
339
+ # @return [Hash] Returns the value in the form of hash
340
+ def _to_hash(value)
341
+ if value.is_a?(Array)
342
+ value.compact.map { |v| _to_hash(v) }
343
+ elsif value.is_a?(Hash)
344
+ {}.tap do |hash|
345
+ value.each { |k, v| hash[k] = _to_hash(v) }
346
+ end
347
+ elsif value.respond_to? :to_hash
348
+ value.to_hash
349
+ else
350
+ value
351
+ end
352
+ end
353
+
354
+ end
355
+ end