ultracart_api 3.10.164 → 3.10.166

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