ultracart_api 3.10.164 → 3.10.165

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +26 -4
  3. data/docs/WorkflowApi.md +436 -0
  4. data/docs/WorkflowAttachment.md +12 -0
  5. data/docs/WorkflowAttachmentUploadUrl.md +9 -0
  6. data/docs/WorkflowAttachmentUploadUrlResponse.md +12 -0
  7. data/docs/WorkflowGroup.md +9 -0
  8. data/docs/WorkflowGroupsResponse.md +12 -0
  9. data/docs/WorkflowNote.md +13 -0
  10. data/docs/WorkflowTask.md +29 -0
  11. data/docs/WorkflowTaskHistory.md +11 -0
  12. data/docs/WorkflowTaskResponse.md +12 -0
  13. data/docs/WorkflowTasksRequest.md +23 -0
  14. data/docs/WorkflowTasksResponse.md +12 -0
  15. data/docs/WorkflowUser.md +10 -0
  16. data/docs/WorkflowUsersResponse.md +12 -0
  17. data/lib/ultracart_api/api/workflow_api.rb +497 -0
  18. data/lib/ultracart_api/models/workflow_attachment.rb +225 -0
  19. data/lib/ultracart_api/models/workflow_attachment_upload_url.rb +193 -0
  20. data/lib/ultracart_api/models/workflow_attachment_upload_url_response.rb +221 -0
  21. data/lib/ultracart_api/models/workflow_group.rb +195 -0
  22. data/lib/ultracart_api/models/workflow_groups_response.rb +224 -0
  23. data/lib/ultracart_api/models/workflow_note.rb +236 -0
  24. data/lib/ultracart_api/models/workflow_task.rb +458 -0
  25. data/lib/ultracart_api/models/workflow_task_history.rb +214 -0
  26. data/lib/ultracart_api/models/workflow_task_response.rb +221 -0
  27. data/lib/ultracart_api/models/workflow_tasks_request.rb +392 -0
  28. data/lib/ultracart_api/models/workflow_tasks_response.rb +224 -0
  29. data/lib/ultracart_api/models/workflow_user.rb +205 -0
  30. data/lib/ultracart_api/models/workflow_users_response.rb +224 -0
  31. data/lib/ultracart_api/version.rb +1 -1
  32. data/lib/ultracart_api.rb +14 -0
  33. metadata +29 -1
@@ -0,0 +1,458 @@
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 WorkflowTask
17
+ # Assigned to group
18
+ attr_accessor :assigned_to_group
19
+
20
+ # Assigned to group ID
21
+ attr_accessor :assigned_to_group_id
22
+
23
+ # Assigned to user
24
+ attr_accessor :assigned_to_user
25
+
26
+ # Assigned to user ID
27
+ attr_accessor :assigned_to_user_id
28
+
29
+ # Attachments to the Workflow Task
30
+ attr_accessor :attachments
31
+
32
+ attr_accessor :created_by
33
+
34
+ # Date/time that the workflow task was created
35
+ attr_accessor :created_dts
36
+
37
+ # Date/time that the workflow task should delay until
38
+ attr_accessor :delay_until_dts
39
+
40
+ # Date/time that the workflow task is due
41
+ attr_accessor :due_dts
42
+
43
+ # Array of history records for the task
44
+ attr_accessor :histories
45
+
46
+ # Date/time that the workflow task was last updated
47
+ attr_accessor :last_update_dts
48
+
49
+ # Merchant ID
50
+ attr_accessor :merchant_id
51
+
52
+ # Notes on the Workflow Task
53
+ attr_accessor :notes
54
+
55
+ # Object is associated with customer email
56
+ attr_accessor :object_email
57
+
58
+ # Object ID
59
+ attr_accessor :object_id
60
+
61
+ # Object Type
62
+ attr_accessor :object_type
63
+
64
+ # Object URL
65
+ attr_accessor :object_url
66
+
67
+ # Priority
68
+ attr_accessor :priority
69
+
70
+ # Status of the workflow task
71
+ attr_accessor :status
72
+
73
+ # Task Details
74
+ attr_accessor :task_details
75
+
76
+ # Task Name
77
+ attr_accessor :task_name
78
+
79
+ # Workflow Task UUID
80
+ attr_accessor :workflow_task_uuid
81
+
82
+ class EnumAttributeValidator
83
+ attr_reader :datatype
84
+ attr_reader :allowable_values
85
+
86
+ def initialize(datatype, allowable_values)
87
+ @allowable_values = allowable_values.map do |value|
88
+ case datatype.to_s
89
+ when /Integer/i
90
+ value.to_i
91
+ when /Float/i
92
+ value.to_f
93
+ else
94
+ value
95
+ end
96
+ end
97
+ end
98
+
99
+ def valid?(value)
100
+ !value || allowable_values.include?(value)
101
+ end
102
+ end
103
+
104
+ # Attribute mapping from ruby-style variable name to JSON key.
105
+ def self.attribute_map
106
+ {
107
+ :'assigned_to_group' => :'assigned_to_group',
108
+ :'assigned_to_group_id' => :'assigned_to_group_id',
109
+ :'assigned_to_user' => :'assigned_to_user',
110
+ :'assigned_to_user_id' => :'assigned_to_user_id',
111
+ :'attachments' => :'attachments',
112
+ :'created_by' => :'created_by',
113
+ :'created_dts' => :'created_dts',
114
+ :'delay_until_dts' => :'delay_until_dts',
115
+ :'due_dts' => :'due_dts',
116
+ :'histories' => :'histories',
117
+ :'last_update_dts' => :'last_update_dts',
118
+ :'merchant_id' => :'merchant_id',
119
+ :'notes' => :'notes',
120
+ :'object_email' => :'object_email',
121
+ :'object_id' => :'object_id',
122
+ :'object_type' => :'object_type',
123
+ :'object_url' => :'object_url',
124
+ :'priority' => :'priority',
125
+ :'status' => :'status',
126
+ :'task_details' => :'task_details',
127
+ :'task_name' => :'task_name',
128
+ :'workflow_task_uuid' => :'workflow_task_uuid'
129
+ }
130
+ end
131
+
132
+ # Attribute type mapping.
133
+ def self.swagger_types
134
+ {
135
+ :'assigned_to_group' => :'String',
136
+ :'assigned_to_group_id' => :'Integer',
137
+ :'assigned_to_user' => :'String',
138
+ :'assigned_to_user_id' => :'Integer',
139
+ :'attachments' => :'Array<WorkflowAttachment>',
140
+ :'created_by' => :'WorkflowUser',
141
+ :'created_dts' => :'String',
142
+ :'delay_until_dts' => :'String',
143
+ :'due_dts' => :'String',
144
+ :'histories' => :'Array<WorkflowTaskHistory>',
145
+ :'last_update_dts' => :'String',
146
+ :'merchant_id' => :'String',
147
+ :'notes' => :'Array<WorkflowNote>',
148
+ :'object_email' => :'String',
149
+ :'object_id' => :'String',
150
+ :'object_type' => :'String',
151
+ :'object_url' => :'String',
152
+ :'priority' => :'String',
153
+ :'status' => :'String',
154
+ :'task_details' => :'String',
155
+ :'task_name' => :'String',
156
+ :'workflow_task_uuid' => :'String'
157
+ }
158
+ end
159
+
160
+ # Initializes the object
161
+ # @param [Hash] attributes Model attributes in the form of hash
162
+ def initialize(attributes = {})
163
+ return unless attributes.is_a?(Hash)
164
+
165
+ # convert string to symbol for hash key
166
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
167
+
168
+ if attributes.has_key?(:'assigned_to_group')
169
+ self.assigned_to_group = attributes[:'assigned_to_group']
170
+ end
171
+
172
+ if attributes.has_key?(:'assigned_to_group_id')
173
+ self.assigned_to_group_id = attributes[:'assigned_to_group_id']
174
+ end
175
+
176
+ if attributes.has_key?(:'assigned_to_user')
177
+ self.assigned_to_user = attributes[:'assigned_to_user']
178
+ end
179
+
180
+ if attributes.has_key?(:'assigned_to_user_id')
181
+ self.assigned_to_user_id = attributes[:'assigned_to_user_id']
182
+ end
183
+
184
+ if attributes.has_key?(:'attachments')
185
+ if (value = attributes[:'attachments']).is_a?(Array)
186
+ self.attachments = value
187
+ end
188
+ end
189
+
190
+ if attributes.has_key?(:'created_by')
191
+ self.created_by = attributes[:'created_by']
192
+ end
193
+
194
+ if attributes.has_key?(:'created_dts')
195
+ self.created_dts = attributes[:'created_dts']
196
+ end
197
+
198
+ if attributes.has_key?(:'delay_until_dts')
199
+ self.delay_until_dts = attributes[:'delay_until_dts']
200
+ end
201
+
202
+ if attributes.has_key?(:'due_dts')
203
+ self.due_dts = attributes[:'due_dts']
204
+ end
205
+
206
+ if attributes.has_key?(:'histories')
207
+ if (value = attributes[:'histories']).is_a?(Array)
208
+ self.histories = value
209
+ end
210
+ end
211
+
212
+ if attributes.has_key?(:'last_update_dts')
213
+ self.last_update_dts = attributes[:'last_update_dts']
214
+ end
215
+
216
+ if attributes.has_key?(:'merchant_id')
217
+ self.merchant_id = attributes[:'merchant_id']
218
+ end
219
+
220
+ if attributes.has_key?(:'notes')
221
+ if (value = attributes[:'notes']).is_a?(Array)
222
+ self.notes = value
223
+ end
224
+ end
225
+
226
+ if attributes.has_key?(:'object_email')
227
+ self.object_email = attributes[:'object_email']
228
+ end
229
+
230
+ if attributes.has_key?(:'object_id')
231
+ self.object_id = attributes[:'object_id']
232
+ end
233
+
234
+ if attributes.has_key?(:'object_type')
235
+ self.object_type = attributes[:'object_type']
236
+ end
237
+
238
+ if attributes.has_key?(:'object_url')
239
+ self.object_url = attributes[:'object_url']
240
+ end
241
+
242
+ if attributes.has_key?(:'priority')
243
+ self.priority = attributes[:'priority']
244
+ end
245
+
246
+ if attributes.has_key?(:'status')
247
+ self.status = attributes[:'status']
248
+ end
249
+
250
+ if attributes.has_key?(:'task_details')
251
+ self.task_details = attributes[:'task_details']
252
+ end
253
+
254
+ if attributes.has_key?(:'task_name')
255
+ self.task_name = attributes[:'task_name']
256
+ end
257
+
258
+ if attributes.has_key?(:'workflow_task_uuid')
259
+ self.workflow_task_uuid = attributes[:'workflow_task_uuid']
260
+ end
261
+ end
262
+
263
+ # Show invalid properties with the reasons. Usually used together with valid?
264
+ # @return Array for valid properties with the reasons
265
+ def list_invalid_properties
266
+ invalid_properties = Array.new
267
+ invalid_properties
268
+ end
269
+
270
+ # Check to see if the all the properties in the model are valid
271
+ # @return true if the model is valid
272
+ def valid?
273
+ object_type_validator = EnumAttributeValidator.new('String', ['order', 'auto order', 'item', 'customer profile'])
274
+ return false unless object_type_validator.valid?(@object_type)
275
+ priority_validator = EnumAttributeValidator.new('String', ['1 - low', '2 - medium', '3 - high', '4 - critical'])
276
+ return false unless priority_validator.valid?(@priority)
277
+ status_validator = EnumAttributeValidator.new('String', ['open', 'closed', 'delayed', 'awaiting customer feedback'])
278
+ return false unless status_validator.valid?(@status)
279
+ true
280
+ end
281
+
282
+ # Custom attribute writer method checking allowed values (enum).
283
+ # @param [Object] object_type Object to be assigned
284
+ def object_type=(object_type)
285
+ validator = EnumAttributeValidator.new('String', ['order', 'auto order', 'item', 'customer profile'])
286
+ unless validator.valid?(object_type)
287
+ fail ArgumentError, 'invalid value for "object_type", must be one of #{validator.allowable_values}.'
288
+ end
289
+ @object_type = object_type
290
+ end
291
+
292
+ # Custom attribute writer method checking allowed values (enum).
293
+ # @param [Object] priority Object to be assigned
294
+ def priority=(priority)
295
+ validator = EnumAttributeValidator.new('String', ['1 - low', '2 - medium', '3 - high', '4 - critical'])
296
+ unless validator.valid?(priority)
297
+ fail ArgumentError, 'invalid value for "priority", must be one of #{validator.allowable_values}.'
298
+ end
299
+ @priority = priority
300
+ end
301
+
302
+ # Custom attribute writer method checking allowed values (enum).
303
+ # @param [Object] status Object to be assigned
304
+ def status=(status)
305
+ validator = EnumAttributeValidator.new('String', ['open', 'closed', 'delayed', 'awaiting customer feedback'])
306
+ unless validator.valid?(status)
307
+ fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
308
+ end
309
+ @status = status
310
+ end
311
+
312
+ # Checks equality by comparing each attribute.
313
+ # @param [Object] Object to be compared
314
+ def ==(o)
315
+ return true if self.equal?(o)
316
+ self.class == o.class &&
317
+ assigned_to_group == o.assigned_to_group &&
318
+ assigned_to_group_id == o.assigned_to_group_id &&
319
+ assigned_to_user == o.assigned_to_user &&
320
+ assigned_to_user_id == o.assigned_to_user_id &&
321
+ attachments == o.attachments &&
322
+ created_by == o.created_by &&
323
+ created_dts == o.created_dts &&
324
+ delay_until_dts == o.delay_until_dts &&
325
+ due_dts == o.due_dts &&
326
+ histories == o.histories &&
327
+ last_update_dts == o.last_update_dts &&
328
+ merchant_id == o.merchant_id &&
329
+ notes == o.notes &&
330
+ object_email == o.object_email &&
331
+ object_id == o.object_id &&
332
+ object_type == o.object_type &&
333
+ object_url == o.object_url &&
334
+ priority == o.priority &&
335
+ status == o.status &&
336
+ task_details == o.task_details &&
337
+ task_name == o.task_name &&
338
+ workflow_task_uuid == o.workflow_task_uuid
339
+ end
340
+
341
+ # @see the `==` method
342
+ # @param [Object] Object to be compared
343
+ def eql?(o)
344
+ self == o
345
+ end
346
+
347
+ # Calculates hash code according to all attributes.
348
+ # @return [Fixnum] Hash code
349
+ def hash
350
+ [assigned_to_group, assigned_to_group_id, assigned_to_user, assigned_to_user_id, attachments, created_by, created_dts, delay_until_dts, due_dts, histories, last_update_dts, merchant_id, notes, object_email, object_id, object_type, object_url, priority, status, task_details, task_name, workflow_task_uuid].hash
351
+ end
352
+
353
+ # Builds the object from hash
354
+ # @param [Hash] attributes Model attributes in the form of hash
355
+ # @return [Object] Returns the model itself
356
+ def build_from_hash(attributes)
357
+ return nil unless attributes.is_a?(Hash)
358
+ self.class.swagger_types.each_pair do |key, type|
359
+ if type =~ /\AArray<(.*)>/i
360
+ # check to ensure the input is an array given that the attribute
361
+ # is documented as an array but the input is not
362
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
363
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
364
+ end
365
+ elsif !attributes[self.class.attribute_map[key]].nil?
366
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
367
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
368
+ end
369
+
370
+ self
371
+ end
372
+
373
+ # Deserializes the data based on type
374
+ # @param string type Data type
375
+ # @param string value Value to be deserialized
376
+ # @return [Object] Deserialized data
377
+ def _deserialize(type, value)
378
+ case type.to_sym
379
+ when :DateTime
380
+ DateTime.parse(value)
381
+ when :Date
382
+ Date.parse(value)
383
+ when :String
384
+ value.to_s
385
+ when :Integer
386
+ value.to_i
387
+ when :Float
388
+ value.to_f
389
+ when :BOOLEAN
390
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
391
+ true
392
+ else
393
+ false
394
+ end
395
+ when :Object
396
+ # generic object (usually a Hash), return directly
397
+ value
398
+ when /\AArray<(?<inner_type>.+)>\z/
399
+ inner_type = Regexp.last_match[:inner_type]
400
+ value.map { |v| _deserialize(inner_type, v) }
401
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
402
+ k_type = Regexp.last_match[:k_type]
403
+ v_type = Regexp.last_match[:v_type]
404
+ {}.tap do |hash|
405
+ value.each do |k, v|
406
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
407
+ end
408
+ end
409
+ else # model
410
+ temp_model = UltracartClient.const_get(type).new
411
+ temp_model.build_from_hash(value)
412
+ end
413
+ end
414
+
415
+ # Returns the string representation of the object
416
+ # @return [String] String presentation of the object
417
+ def to_s
418
+ to_hash.to_s
419
+ end
420
+
421
+ # to_body is an alias to to_hash (backward compatibility)
422
+ # @return [Hash] Returns the object in the form of hash
423
+ def to_body
424
+ to_hash
425
+ end
426
+
427
+ # Returns the object in the form of hash
428
+ # @return [Hash] Returns the object in the form of hash
429
+ def to_hash
430
+ hash = {}
431
+ self.class.attribute_map.each_pair do |attr, param|
432
+ value = self.send(attr)
433
+ next if value.nil?
434
+ hash[param] = _to_hash(value)
435
+ end
436
+ hash
437
+ end
438
+
439
+ # Outputs non-array value in the form of hash
440
+ # For object, use to_hash. Otherwise, just return the value
441
+ # @param [Object] value Any valid value
442
+ # @return [Hash] Returns the value in the form of hash
443
+ def _to_hash(value)
444
+ if value.is_a?(Array)
445
+ value.compact.map { |v| _to_hash(v) }
446
+ elsif value.is_a?(Hash)
447
+ {}.tap do |hash|
448
+ value.each { |k, v| hash[k] = _to_hash(v) }
449
+ end
450
+ elsif value.respond_to? :to_hash
451
+ value.to_hash
452
+ else
453
+ value
454
+ end
455
+ end
456
+
457
+ end
458
+ end
@@ -0,0 +1,214 @@
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 WorkflowTaskHistory
17
+ # Date/time that the workflow task history record was created
18
+ attr_accessor :activity_dts
19
+
20
+ # Description of the activity
21
+ attr_accessor :description
22
+
23
+ # IP Address that originated the activity
24
+ attr_accessor :ip_address
25
+
26
+ attr_accessor :user
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'activity_dts' => :'activity_dts',
32
+ :'description' => :'description',
33
+ :'ip_address' => :'ip_address',
34
+ :'user' => :'user'
35
+ }
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.swagger_types
40
+ {
41
+ :'activity_dts' => :'String',
42
+ :'description' => :'String',
43
+ :'ip_address' => :'String',
44
+ :'user' => :'WorkflowUser'
45
+ }
46
+ end
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ def initialize(attributes = {})
51
+ return unless attributes.is_a?(Hash)
52
+
53
+ # convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
55
+
56
+ if attributes.has_key?(:'activity_dts')
57
+ self.activity_dts = attributes[:'activity_dts']
58
+ end
59
+
60
+ if attributes.has_key?(:'description')
61
+ self.description = attributes[:'description']
62
+ end
63
+
64
+ if attributes.has_key?(:'ip_address')
65
+ self.ip_address = attributes[:'ip_address']
66
+ end
67
+
68
+ if attributes.has_key?(:'user')
69
+ self.user = attributes[:'user']
70
+ end
71
+ end
72
+
73
+ # Show invalid properties with the reasons. Usually used together with valid?
74
+ # @return Array for valid properties with the reasons
75
+ def list_invalid_properties
76
+ invalid_properties = Array.new
77
+ invalid_properties
78
+ end
79
+
80
+ # Check to see if the all the properties in the model are valid
81
+ # @return true if the model is valid
82
+ def valid?
83
+ true
84
+ end
85
+
86
+ # Checks equality by comparing each attribute.
87
+ # @param [Object] Object to be compared
88
+ def ==(o)
89
+ return true if self.equal?(o)
90
+ self.class == o.class &&
91
+ activity_dts == o.activity_dts &&
92
+ description == o.description &&
93
+ ip_address == o.ip_address &&
94
+ user == o.user
95
+ end
96
+
97
+ # @see the `==` method
98
+ # @param [Object] Object to be compared
99
+ def eql?(o)
100
+ self == o
101
+ end
102
+
103
+ # Calculates hash code according to all attributes.
104
+ # @return [Fixnum] Hash code
105
+ def hash
106
+ [activity_dts, description, ip_address, user].hash
107
+ end
108
+
109
+ # Builds the object from hash
110
+ # @param [Hash] attributes Model attributes in the form of hash
111
+ # @return [Object] Returns the model itself
112
+ def build_from_hash(attributes)
113
+ return nil unless attributes.is_a?(Hash)
114
+ self.class.swagger_types.each_pair do |key, type|
115
+ if type =~ /\AArray<(.*)>/i
116
+ # check to ensure the input is an array given that the attribute
117
+ # is documented as an array but the input is not
118
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
119
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
120
+ end
121
+ elsif !attributes[self.class.attribute_map[key]].nil?
122
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
123
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def _deserialize(type, value)
134
+ case type.to_sym
135
+ when :DateTime
136
+ DateTime.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :BOOLEAN
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ temp_model = UltracartClient.const_get(type).new
167
+ temp_model.build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ next if value.nil?
190
+ hash[param] = _to_hash(value)
191
+ end
192
+ hash
193
+ end
194
+
195
+ # Outputs non-array value in the form of hash
196
+ # For object, use to_hash. Otherwise, just return the value
197
+ # @param [Object] value Any valid value
198
+ # @return [Hash] Returns the value in the form of hash
199
+ def _to_hash(value)
200
+ if value.is_a?(Array)
201
+ value.compact.map { |v| _to_hash(v) }
202
+ elsif value.is_a?(Hash)
203
+ {}.tap do |hash|
204
+ value.each { |k, v| hash[k] = _to_hash(v) }
205
+ end
206
+ elsif value.respond_to? :to_hash
207
+ value.to_hash
208
+ else
209
+ value
210
+ end
211
+ end
212
+
213
+ end
214
+ end