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
@@ -362,6 +362,55 @@ module UltracartClient
362
362
  end
363
363
  return data, status_code, headers
364
364
  end
365
+ # Get a list of existing workflow task tags
366
+ # Retrieves a unique list of all the existing workflow task tags.
367
+ # @param [Hash] opts the optional parameters
368
+ # @return [WorkflowTaskTagsResponse]
369
+ def get_workflow_task_tags(opts = {})
370
+ data, _status_code, _headers = get_workflow_task_tags_with_http_info(opts)
371
+ data
372
+ end
373
+
374
+ # Get a list of existing workflow task tags
375
+ # Retrieves a unique list of all the existing workflow task tags.
376
+ # @param [Hash] opts the optional parameters
377
+ # @return [Array<(WorkflowTaskTagsResponse, Fixnum, Hash)>] WorkflowTaskTagsResponse data, response status code and response headers
378
+ def get_workflow_task_tags_with_http_info(opts = {})
379
+ if @api_client.config.debugging
380
+ @api_client.config.logger.debug 'Calling API: WorkflowApi.get_workflow_task_tags ...'
381
+ end
382
+ # resource path
383
+ local_var_path = '/workflow/tasks/tags'
384
+
385
+ # query parameters
386
+ query_params = {}
387
+
388
+ # header parameters
389
+ header_params = {}
390
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
391
+ # HTTP header 'Accept' (if needed)
392
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
393
+ # HTTP header 'Content-Type'
394
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
395
+
396
+ # form parameters
397
+ form_params = {}
398
+
399
+ # http body (model)
400
+ post_body = nil
401
+ auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
402
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
403
+ :header_params => header_params,
404
+ :query_params => query_params,
405
+ :form_params => form_params,
406
+ :body => post_body,
407
+ :auth_names => auth_names,
408
+ :return_type => 'WorkflowTaskTagsResponse')
409
+ if @api_client.config.debugging
410
+ @api_client.config.logger.debug "API called: WorkflowApi#get_workflow_task_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
411
+ end
412
+ return data, status_code, headers
413
+ end
365
414
  # Search workflow tasks
366
415
  # Retrieves a set of workflow tasks from the account based on a query object.
367
416
  # @param workflow_tasks_query Workflow tasks query
@@ -0,0 +1,325 @@
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 ConversationPbxAgent
17
+ # Cellphone number of agent in E.164 format
18
+ attr_accessor :cellphone
19
+
20
+ # Conversation Pbx Agent unique identifier
21
+ attr_accessor :conversation_pbx_agent_uuid
22
+
23
+ # Conversation Pbx Voicemail Mailbox UUID
24
+ attr_accessor :conversation_pbx_voicemail_mailbox_uuid
25
+
26
+ # True if calls to this agent should be forwarded to their cellphone
27
+ attr_accessor :forward_calls_to_cellphone
28
+
29
+ # Merchant Id
30
+ attr_accessor :merchant_id
31
+
32
+ # True if outgoing calls should be automatically recorded
33
+ attr_accessor :record_outgoing_automatically
34
+
35
+ # Twilio taskrouter worker Id
36
+ attr_accessor :twilio_taskrouter_worker_id
37
+
38
+ # User Id
39
+ attr_accessor :user_id
40
+
41
+ # True if this agent has voicemail configured
42
+ attr_accessor :voicemail
43
+
44
+ # Attribute mapping from ruby-style variable name to JSON key.
45
+ def self.attribute_map
46
+ {
47
+ :'cellphone' => :'cellphone',
48
+ :'conversation_pbx_agent_uuid' => :'conversation_pbx_agent_uuid',
49
+ :'conversation_pbx_voicemail_mailbox_uuid' => :'conversation_pbx_voicemail_mailbox_uuid',
50
+ :'forward_calls_to_cellphone' => :'forward_calls_to_cellphone',
51
+ :'merchant_id' => :'merchant_id',
52
+ :'record_outgoing_automatically' => :'record_outgoing_automatically',
53
+ :'twilio_taskrouter_worker_id' => :'twilio_taskrouter_worker_id',
54
+ :'user_id' => :'user_id',
55
+ :'voicemail' => :'voicemail'
56
+ }
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.swagger_types
61
+ {
62
+ :'cellphone' => :'String',
63
+ :'conversation_pbx_agent_uuid' => :'String',
64
+ :'conversation_pbx_voicemail_mailbox_uuid' => :'String',
65
+ :'forward_calls_to_cellphone' => :'BOOLEAN',
66
+ :'merchant_id' => :'String',
67
+ :'record_outgoing_automatically' => :'BOOLEAN',
68
+ :'twilio_taskrouter_worker_id' => :'String',
69
+ :'user_id' => :'Integer',
70
+ :'voicemail' => :'BOOLEAN'
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?(:'cellphone')
83
+ self.cellphone = attributes[:'cellphone']
84
+ end
85
+
86
+ if attributes.has_key?(:'conversation_pbx_agent_uuid')
87
+ self.conversation_pbx_agent_uuid = attributes[:'conversation_pbx_agent_uuid']
88
+ end
89
+
90
+ if attributes.has_key?(:'conversation_pbx_voicemail_mailbox_uuid')
91
+ self.conversation_pbx_voicemail_mailbox_uuid = attributes[:'conversation_pbx_voicemail_mailbox_uuid']
92
+ end
93
+
94
+ if attributes.has_key?(:'forward_calls_to_cellphone')
95
+ self.forward_calls_to_cellphone = attributes[:'forward_calls_to_cellphone']
96
+ end
97
+
98
+ if attributes.has_key?(:'merchant_id')
99
+ self.merchant_id = attributes[:'merchant_id']
100
+ end
101
+
102
+ if attributes.has_key?(:'record_outgoing_automatically')
103
+ self.record_outgoing_automatically = attributes[:'record_outgoing_automatically']
104
+ end
105
+
106
+ if attributes.has_key?(:'twilio_taskrouter_worker_id')
107
+ self.twilio_taskrouter_worker_id = attributes[:'twilio_taskrouter_worker_id']
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?(:'voicemail')
115
+ self.voicemail = attributes[:'voicemail']
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 !@cellphone.nil? && @cellphone.to_s.length > 50
124
+ invalid_properties.push('invalid value for "cellphone", the character length must be smaller than or equal to 50.')
125
+ end
126
+
127
+ if !@conversation_pbx_voicemail_mailbox_uuid.nil? && @conversation_pbx_voicemail_mailbox_uuid.to_s.length > 50
128
+ invalid_properties.push('invalid value for "conversation_pbx_voicemail_mailbox_uuid", the character length must be smaller than or equal to 50.')
129
+ end
130
+
131
+ if !@merchant_id.nil? && @merchant_id.to_s.length > 5
132
+ invalid_properties.push('invalid value for "merchant_id", the character length must be smaller than or equal to 5.')
133
+ end
134
+
135
+ if !@twilio_taskrouter_worker_id.nil? && @twilio_taskrouter_worker_id.to_s.length > 100
136
+ invalid_properties.push('invalid value for "twilio_taskrouter_worker_id", the character length must be smaller than or equal to 100.')
137
+ end
138
+
139
+ invalid_properties
140
+ end
141
+
142
+ # Check to see if the all the properties in the model are valid
143
+ # @return true if the model is valid
144
+ def valid?
145
+ return false if !@cellphone.nil? && @cellphone.to_s.length > 50
146
+ return false if !@conversation_pbx_voicemail_mailbox_uuid.nil? && @conversation_pbx_voicemail_mailbox_uuid.to_s.length > 50
147
+ return false if !@merchant_id.nil? && @merchant_id.to_s.length > 5
148
+ return false if !@twilio_taskrouter_worker_id.nil? && @twilio_taskrouter_worker_id.to_s.length > 100
149
+ true
150
+ end
151
+
152
+ # Custom attribute writer method with validation
153
+ # @param [Object] cellphone Value to be assigned
154
+ def cellphone=(cellphone)
155
+ if !cellphone.nil? && cellphone.to_s.length > 50
156
+ fail ArgumentError, 'invalid value for "cellphone", the character length must be smaller than or equal to 50.'
157
+ end
158
+
159
+ @cellphone = cellphone
160
+ end
161
+
162
+ # Custom attribute writer method with validation
163
+ # @param [Object] conversation_pbx_voicemail_mailbox_uuid Value to be assigned
164
+ def conversation_pbx_voicemail_mailbox_uuid=(conversation_pbx_voicemail_mailbox_uuid)
165
+ if !conversation_pbx_voicemail_mailbox_uuid.nil? && conversation_pbx_voicemail_mailbox_uuid.to_s.length > 50
166
+ fail ArgumentError, 'invalid value for "conversation_pbx_voicemail_mailbox_uuid", the character length must be smaller than or equal to 50.'
167
+ end
168
+
169
+ @conversation_pbx_voicemail_mailbox_uuid = conversation_pbx_voicemail_mailbox_uuid
170
+ end
171
+
172
+ # Custom attribute writer method with validation
173
+ # @param [Object] merchant_id Value to be assigned
174
+ def merchant_id=(merchant_id)
175
+ if !merchant_id.nil? && merchant_id.to_s.length > 5
176
+ fail ArgumentError, 'invalid value for "merchant_id", the character length must be smaller than or equal to 5.'
177
+ end
178
+
179
+ @merchant_id = merchant_id
180
+ end
181
+
182
+ # Custom attribute writer method with validation
183
+ # @param [Object] twilio_taskrouter_worker_id Value to be assigned
184
+ def twilio_taskrouter_worker_id=(twilio_taskrouter_worker_id)
185
+ if !twilio_taskrouter_worker_id.nil? && twilio_taskrouter_worker_id.to_s.length > 100
186
+ fail ArgumentError, 'invalid value for "twilio_taskrouter_worker_id", the character length must be smaller than or equal to 100.'
187
+ end
188
+
189
+ @twilio_taskrouter_worker_id = twilio_taskrouter_worker_id
190
+ end
191
+
192
+ # Checks equality by comparing each attribute.
193
+ # @param [Object] Object to be compared
194
+ def ==(o)
195
+ return true if self.equal?(o)
196
+ self.class == o.class &&
197
+ cellphone == o.cellphone &&
198
+ conversation_pbx_agent_uuid == o.conversation_pbx_agent_uuid &&
199
+ conversation_pbx_voicemail_mailbox_uuid == o.conversation_pbx_voicemail_mailbox_uuid &&
200
+ forward_calls_to_cellphone == o.forward_calls_to_cellphone &&
201
+ merchant_id == o.merchant_id &&
202
+ record_outgoing_automatically == o.record_outgoing_automatically &&
203
+ twilio_taskrouter_worker_id == o.twilio_taskrouter_worker_id &&
204
+ user_id == o.user_id &&
205
+ voicemail == o.voicemail
206
+ end
207
+
208
+ # @see the `==` method
209
+ # @param [Object] Object to be compared
210
+ def eql?(o)
211
+ self == o
212
+ end
213
+
214
+ # Calculates hash code according to all attributes.
215
+ # @return [Fixnum] Hash code
216
+ def hash
217
+ [cellphone, conversation_pbx_agent_uuid, conversation_pbx_voicemail_mailbox_uuid, forward_calls_to_cellphone, merchant_id, record_outgoing_automatically, twilio_taskrouter_worker_id, user_id, voicemail].hash
218
+ end
219
+
220
+ # Builds the object from hash
221
+ # @param [Hash] attributes Model attributes in the form of hash
222
+ # @return [Object] Returns the model itself
223
+ def build_from_hash(attributes)
224
+ return nil unless attributes.is_a?(Hash)
225
+ self.class.swagger_types.each_pair do |key, type|
226
+ if type =~ /\AArray<(.*)>/i
227
+ # check to ensure the input is an array given that the attribute
228
+ # is documented as an array but the input is not
229
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
230
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
231
+ end
232
+ elsif !attributes[self.class.attribute_map[key]].nil?
233
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
234
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
235
+ end
236
+
237
+ self
238
+ end
239
+
240
+ # Deserializes the data based on type
241
+ # @param string type Data type
242
+ # @param string value Value to be deserialized
243
+ # @return [Object] Deserialized data
244
+ def _deserialize(type, value)
245
+ case type.to_sym
246
+ when :DateTime
247
+ DateTime.parse(value)
248
+ when :Date
249
+ Date.parse(value)
250
+ when :String
251
+ value.to_s
252
+ when :Integer
253
+ value.to_i
254
+ when :Float
255
+ value.to_f
256
+ when :BOOLEAN
257
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
258
+ true
259
+ else
260
+ false
261
+ end
262
+ when :Object
263
+ # generic object (usually a Hash), return directly
264
+ value
265
+ when /\AArray<(?<inner_type>.+)>\z/
266
+ inner_type = Regexp.last_match[:inner_type]
267
+ value.map { |v| _deserialize(inner_type, v) }
268
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
269
+ k_type = Regexp.last_match[:k_type]
270
+ v_type = Regexp.last_match[:v_type]
271
+ {}.tap do |hash|
272
+ value.each do |k, v|
273
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
274
+ end
275
+ end
276
+ else # model
277
+ temp_model = UltracartClient.const_get(type).new
278
+ temp_model.build_from_hash(value)
279
+ end
280
+ end
281
+
282
+ # Returns the string representation of the object
283
+ # @return [String] String presentation of the object
284
+ def to_s
285
+ to_hash.to_s
286
+ end
287
+
288
+ # to_body is an alias to to_hash (backward compatibility)
289
+ # @return [Hash] Returns the object in the form of hash
290
+ def to_body
291
+ to_hash
292
+ end
293
+
294
+ # Returns the object in the form of hash
295
+ # @return [Hash] Returns the object in the form of hash
296
+ def to_hash
297
+ hash = {}
298
+ self.class.attribute_map.each_pair do |attr, param|
299
+ value = self.send(attr)
300
+ next if value.nil?
301
+ hash[param] = _to_hash(value)
302
+ end
303
+ hash
304
+ end
305
+
306
+ # Outputs non-array value in the form of hash
307
+ # For object, use to_hash. Otherwise, just return the value
308
+ # @param [Object] value Any valid value
309
+ # @return [Hash] Returns the value in the form of hash
310
+ def _to_hash(value)
311
+ if value.is_a?(Array)
312
+ value.compact.map { |v| _to_hash(v) }
313
+ elsif value.is_a?(Hash)
314
+ {}.tap do |hash|
315
+ value.each { |k, v| hash[k] = _to_hash(v) }
316
+ end
317
+ elsif value.respond_to? :to_hash
318
+ value.to_hash
319
+ else
320
+ value
321
+ end
322
+ end
323
+
324
+ end
325
+ end
@@ -0,0 +1,221 @@
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 ConversationPbxAgentResponse
17
+ attr_accessor :agent
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
+ :'agent' => :'agent',
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
+ :'agent' => :'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?(:'agent')
59
+ self.agent = attributes[:'agent']
60
+ end
61
+
62
+ if attributes.has_key?(:'error')
63
+ self.error = attributes[:'error']
64
+ end
65
+
66
+ if attributes.has_key?(:'metadata')
67
+ self.metadata = attributes[:'metadata']
68
+ end
69
+
70
+ if attributes.has_key?(:'success')
71
+ self.success = attributes[:'success']
72
+ end
73
+
74
+ if attributes.has_key?(:'warning')
75
+ self.warning = attributes[:'warning']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ agent == o.agent &&
98
+ error == o.error &&
99
+ metadata == o.metadata &&
100
+ success == o.success &&
101
+ warning == o.warning
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Fixnum] Hash code
112
+ def hash
113
+ [agent, error, metadata, success, warning].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ self.class.swagger_types.each_pair do |key, type|
122
+ if type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :DateTime
143
+ DateTime.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :BOOLEAN
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ temp_model = UltracartClient.const_get(type).new
174
+ temp_model.build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ # Returns the object in the form of hash
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_hash
193
+ hash = {}
194
+ self.class.attribute_map.each_pair do |attr, param|
195
+ value = self.send(attr)
196
+ next if value.nil?
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map { |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
217
+ end
218
+ end
219
+
220
+ end
221
+ end