ultracart_api 4.1.199 → 4.1.201

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +28 -2
  3. data/docs/SfvbApi.md +578 -13
  4. data/docs/SfvbApprovalCreateRequest.md +6 -0
  5. data/docs/SfvbApprovalParams.md +23 -3
  6. data/docs/SfvbContainerVersion.md +1 -1
  7. data/docs/SfvbEvent.md +28 -0
  8. data/docs/SfvbEventsAuthRequest.md +18 -0
  9. data/docs/SfvbEventsAuthResponse.md +22 -0
  10. data/docs/SfvbEventsResponse.md +22 -0
  11. data/docs/SfvbI18nMessageValue.md +1 -1
  12. data/docs/SfvbItemAttributeBatchRequest.md +20 -0
  13. data/docs/SfvbItemAttributeBatchResponse.md +40 -0
  14. data/docs/SfvbItemAttributeBatchRow.md +30 -0
  15. data/docs/SfvbItemAttributeBatchRowResult.md +36 -0
  16. data/docs/SfvbItemPricing.md +38 -0
  17. data/docs/SfvbItemPricingRequest.md +32 -0
  18. data/docs/SfvbItemRelated.md +28 -0
  19. data/docs/SfvbItemRelatedItem.md +22 -0
  20. data/docs/SfvbItemRelatedRequest.md +22 -0
  21. data/docs/SfvbItemVolumeDiscount.md +20 -0
  22. data/docs/SfvbThemeJobResponse.md +3 -3
  23. data/lib/ultracart_api/api/sfvb_api.rb +831 -72
  24. data/lib/ultracart_api/models/sfvb_approval_create_request.rb +33 -3
  25. data/lib/ultracart_api/models/sfvb_approval_params.rb +142 -6
  26. data/lib/ultracart_api/models/sfvb_container_version.rb +1 -1
  27. data/lib/ultracart_api/models/sfvb_event.rb +270 -0
  28. data/lib/ultracart_api/models/sfvb_events_auth_request.rb +222 -0
  29. data/lib/ultracart_api/models/sfvb_events_auth_response.rb +240 -0
  30. data/lib/ultracart_api/models/sfvb_events_response.rb +242 -0
  31. data/lib/ultracart_api/models/sfvb_i18n_message_value.rb +1 -1
  32. data/lib/ultracart_api/models/sfvb_item_attribute_batch_request.rb +232 -0
  33. data/lib/ultracart_api/models/sfvb_item_attribute_batch_response.rb +332 -0
  34. data/lib/ultracart_api/models/sfvb_item_attribute_batch_row.rb +280 -0
  35. data/lib/ultracart_api/models/sfvb_item_attribute_batch_row_result.rb +344 -0
  36. data/lib/ultracart_api/models/sfvb_item_pricing.rb +322 -0
  37. data/lib/ultracart_api/models/sfvb_item_pricing_request.rb +292 -0
  38. data/lib/ultracart_api/models/sfvb_item_related.rb +272 -0
  39. data/lib/ultracart_api/models/sfvb_item_related_item.rb +274 -0
  40. data/lib/ultracart_api/models/sfvb_item_related_request.rb +242 -0
  41. data/lib/ultracart_api/models/sfvb_item_volume_discount.rb +230 -0
  42. data/lib/ultracart_api/models/sfvb_theme_job_response.rb +3 -3
  43. data/lib/ultracart_api/version.rb +1 -1
  44. data/lib/ultracart_api.rb +14 -0
  45. metadata +30 -2
@@ -0,0 +1,322 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class SfvbItemPricing
18
+ # The price.
19
+ attr_accessor :cost
20
+
21
+ # The currency every amount is in. Read only here.
22
+ attr_accessor :currency_code
23
+
24
+ # The hash of the pricing above. Send it as If-Match to change it.
25
+ attr_accessor :hash_sha256
26
+
27
+ # The item's merchant item id.
28
+ attr_accessor :merchant_item_id
29
+
30
+ # The item.
31
+ attr_accessor :merchant_item_oid
32
+
33
+ # The manufacturer suggested retail price, when set.
34
+ attr_accessor :msrp
35
+
36
+ # Whether the sale price applies right now.
37
+ attr_accessor :sale_active
38
+
39
+ # The sale price, when a sale is set.
40
+ attr_accessor :sale_cost
41
+
42
+ # When the sale ends, ISO 8601.
43
+ attr_accessor :sale_end
44
+
45
+ # When the sale starts, ISO 8601.
46
+ attr_accessor :sale_start
47
+
48
+ # Retail quantity breaks, lowest quantity first. Wholesale pricing tiers are not shown or changed here.
49
+ attr_accessor :volume_discounts
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'cost' => :'cost',
55
+ :'currency_code' => :'currency_code',
56
+ :'hash_sha256' => :'hash_sha256',
57
+ :'merchant_item_id' => :'merchant_item_id',
58
+ :'merchant_item_oid' => :'merchant_item_oid',
59
+ :'msrp' => :'msrp',
60
+ :'sale_active' => :'sale_active',
61
+ :'sale_cost' => :'sale_cost',
62
+ :'sale_end' => :'sale_end',
63
+ :'sale_start' => :'sale_start',
64
+ :'volume_discounts' => :'volume_discounts'
65
+ }
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'cost' => :'Float',
77
+ :'currency_code' => :'String',
78
+ :'hash_sha256' => :'String',
79
+ :'merchant_item_id' => :'String',
80
+ :'merchant_item_oid' => :'Integer',
81
+ :'msrp' => :'Float',
82
+ :'sale_active' => :'Boolean',
83
+ :'sale_cost' => :'Float',
84
+ :'sale_end' => :'String',
85
+ :'sale_start' => :'String',
86
+ :'volume_discounts' => :'Array<SfvbItemVolumeDiscount>'
87
+ }
88
+ end
89
+
90
+ # List of attributes with nullable: true
91
+ def self.openapi_nullable
92
+ Set.new([
93
+ ])
94
+ end
95
+
96
+ # Initializes the object
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ def initialize(attributes = {})
99
+ if (!attributes.is_a?(Hash))
100
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbItemPricing` initialize method"
101
+ end
102
+
103
+ # check to see if the attribute exists and convert string to symbol for hash key
104
+ attributes = attributes.each_with_object({}) { |(k, v), h|
105
+ if (!self.class.attribute_map.key?(k.to_sym))
106
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbItemPricing`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
107
+ end
108
+ h[k.to_sym] = v
109
+ }
110
+
111
+ if attributes.key?(:'cost')
112
+ self.cost = attributes[:'cost']
113
+ end
114
+
115
+ if attributes.key?(:'currency_code')
116
+ self.currency_code = attributes[:'currency_code']
117
+ end
118
+
119
+ if attributes.key?(:'hash_sha256')
120
+ self.hash_sha256 = attributes[:'hash_sha256']
121
+ end
122
+
123
+ if attributes.key?(:'merchant_item_id')
124
+ self.merchant_item_id = attributes[:'merchant_item_id']
125
+ end
126
+
127
+ if attributes.key?(:'merchant_item_oid')
128
+ self.merchant_item_oid = attributes[:'merchant_item_oid']
129
+ end
130
+
131
+ if attributes.key?(:'msrp')
132
+ self.msrp = attributes[:'msrp']
133
+ end
134
+
135
+ if attributes.key?(:'sale_active')
136
+ self.sale_active = attributes[:'sale_active']
137
+ end
138
+
139
+ if attributes.key?(:'sale_cost')
140
+ self.sale_cost = attributes[:'sale_cost']
141
+ end
142
+
143
+ if attributes.key?(:'sale_end')
144
+ self.sale_end = attributes[:'sale_end']
145
+ end
146
+
147
+ if attributes.key?(:'sale_start')
148
+ self.sale_start = attributes[:'sale_start']
149
+ end
150
+
151
+ if attributes.key?(:'volume_discounts')
152
+ if (value = attributes[:'volume_discounts']).is_a?(Array)
153
+ self.volume_discounts = value
154
+ end
155
+ end
156
+ end
157
+
158
+ # Show invalid properties with the reasons. Usually used together with valid?
159
+ # @return Array for valid properties with the reasons
160
+ def list_invalid_properties
161
+ invalid_properties = Array.new
162
+ invalid_properties
163
+ end
164
+
165
+ # Check to see if the all the properties in the model are valid
166
+ # @return true if the model is valid
167
+ def valid?
168
+ true
169
+ end
170
+
171
+ # Checks equality by comparing each attribute.
172
+ # @param [Object] Object to be compared
173
+ def ==(o)
174
+ return true if self.equal?(o)
175
+ self.class == o.class &&
176
+ cost == o.cost &&
177
+ currency_code == o.currency_code &&
178
+ hash_sha256 == o.hash_sha256 &&
179
+ merchant_item_id == o.merchant_item_id &&
180
+ merchant_item_oid == o.merchant_item_oid &&
181
+ msrp == o.msrp &&
182
+ sale_active == o.sale_active &&
183
+ sale_cost == o.sale_cost &&
184
+ sale_end == o.sale_end &&
185
+ sale_start == o.sale_start &&
186
+ volume_discounts == o.volume_discounts
187
+ end
188
+
189
+ # @see the `==` method
190
+ # @param [Object] Object to be compared
191
+ def eql?(o)
192
+ self == o
193
+ end
194
+
195
+ # Calculates hash code according to all attributes.
196
+ # @return [Integer] Hash code
197
+ def hash
198
+ [cost, currency_code, hash_sha256, merchant_item_id, merchant_item_oid, msrp, sale_active, sale_cost, sale_end, sale_start, volume_discounts].hash
199
+ end
200
+
201
+ # Builds the object from hash
202
+ # @param [Hash] attributes Model attributes in the form of hash
203
+ # @return [Object] Returns the model itself
204
+ def self.build_from_hash(attributes)
205
+ new.build_from_hash(attributes)
206
+ end
207
+
208
+ # Builds the object from hash
209
+ # @param [Hash] attributes Model attributes in the form of hash
210
+ # @return [Object] Returns the model itself
211
+ def build_from_hash(attributes)
212
+ return nil unless attributes.is_a?(Hash)
213
+ attributes = attributes.transform_keys(&:to_sym)
214
+ self.class.openapi_types.each_pair do |key, type|
215
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
216
+ self.send("#{key}=", nil)
217
+ elsif type =~ /\AArray<(.*)>/i
218
+ # check to ensure the input is an array given that the attribute
219
+ # is documented as an array but the input is not
220
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
221
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
222
+ end
223
+ elsif !attributes[self.class.attribute_map[key]].nil?
224
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
225
+ end
226
+ end
227
+
228
+ self
229
+ end
230
+
231
+ # Deserializes the data based on type
232
+ # @param string type Data type
233
+ # @param string value Value to be deserialized
234
+ # @return [Object] Deserialized data
235
+ def _deserialize(type, value)
236
+ case type.to_sym
237
+ when :Time
238
+ Time.parse(value)
239
+ when :Date
240
+ Date.parse(value)
241
+ when :String
242
+ value.to_s
243
+ when :Integer
244
+ value.to_i
245
+ when :Float
246
+ value.to_f
247
+ when :Boolean
248
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
249
+ true
250
+ else
251
+ false
252
+ end
253
+ when :Object
254
+ # generic object (usually a Hash), return directly
255
+ value
256
+ when /\AArray<(?<inner_type>.+)>\z/
257
+ inner_type = Regexp.last_match[:inner_type]
258
+ value.map { |v| _deserialize(inner_type, v) }
259
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
260
+ k_type = Regexp.last_match[:k_type]
261
+ v_type = Regexp.last_match[:v_type]
262
+ {}.tap do |hash|
263
+ value.each do |k, v|
264
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
265
+ end
266
+ end
267
+ else # model
268
+ # models (e.g. Pet) or oneOf
269
+ klass = UltracartClient.const_get(type)
270
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
271
+ end
272
+ end
273
+
274
+ # Returns the string representation of the object
275
+ # @return [String] String presentation of the object
276
+ def to_s
277
+ to_hash.to_s
278
+ end
279
+
280
+ # to_body is an alias to to_hash (backward compatibility)
281
+ # @return [Hash] Returns the object in the form of hash
282
+ def to_body
283
+ to_hash
284
+ end
285
+
286
+ # Returns the object in the form of hash
287
+ # @return [Hash] Returns the object in the form of hash
288
+ def to_hash
289
+ hash = {}
290
+ self.class.attribute_map.each_pair do |attr, param|
291
+ value = self.send(attr)
292
+ if value.nil?
293
+ is_nullable = self.class.openapi_nullable.include?(attr)
294
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
295
+ end
296
+
297
+ hash[param] = _to_hash(value)
298
+ end
299
+ hash
300
+ end
301
+
302
+ # Outputs non-array value in the form of hash
303
+ # For object, use to_hash. Otherwise, just return the value
304
+ # @param [Object] value Any valid value
305
+ # @return [Hash] Returns the value in the form of hash
306
+ def _to_hash(value)
307
+ if value.is_a?(Array)
308
+ value.compact.map { |v| _to_hash(v) }
309
+ elsif value.is_a?(Hash)
310
+ {}.tap do |hash|
311
+ value.each { |k, v| hash[k] = _to_hash(v) }
312
+ end
313
+ elsif value.respond_to? :to_hash
314
+ value.to_hash
315
+ else
316
+ value
317
+ end
318
+ end
319
+
320
+ end
321
+
322
+ end
@@ -0,0 +1,292 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class SfvbItemPricingRequest
18
+ # True to remove the MSRP. Not with msrp.
19
+ attr_accessor :clear_msrp
20
+
21
+ # True to remove the sale. Not with sale_cost.
22
+ attr_accessor :clear_sale
23
+
24
+ # The new price, 0 or more.
25
+ attr_accessor :cost
26
+
27
+ # The manufacturer suggested retail price, more than 0 (or 0 when the price is 0).
28
+ attr_accessor :msrp
29
+
30
+ # The sale price, 0 or more. Sent with sale_start and sale_end, all three or none.
31
+ attr_accessor :sale_cost
32
+
33
+ # When the sale ends, ISO 8601 with an offset, after sale_start. Required with sale_cost.
34
+ attr_accessor :sale_end
35
+
36
+ # When the sale starts, ISO 8601 with an offset. Required with sale_cost.
37
+ attr_accessor :sale_start
38
+
39
+ # Replaces the retail quantity breaks. An empty list removes them all. Up to 20, each quantity 2 or more and named once.
40
+ attr_accessor :volume_discounts
41
+
42
+ # Attribute mapping from ruby-style variable name to JSON key.
43
+ def self.attribute_map
44
+ {
45
+ :'clear_msrp' => :'clear_msrp',
46
+ :'clear_sale' => :'clear_sale',
47
+ :'cost' => :'cost',
48
+ :'msrp' => :'msrp',
49
+ :'sale_cost' => :'sale_cost',
50
+ :'sale_end' => :'sale_end',
51
+ :'sale_start' => :'sale_start',
52
+ :'volume_discounts' => :'volume_discounts'
53
+ }
54
+ end
55
+
56
+ # Returns all the JSON keys this model knows about
57
+ def self.acceptable_attributes
58
+ attribute_map.values
59
+ end
60
+
61
+ # Attribute type mapping.
62
+ def self.openapi_types
63
+ {
64
+ :'clear_msrp' => :'Boolean',
65
+ :'clear_sale' => :'Boolean',
66
+ :'cost' => :'Float',
67
+ :'msrp' => :'Float',
68
+ :'sale_cost' => :'Float',
69
+ :'sale_end' => :'String',
70
+ :'sale_start' => :'String',
71
+ :'volume_discounts' => :'Array<SfvbItemVolumeDiscount>'
72
+ }
73
+ end
74
+
75
+ # List of attributes with nullable: true
76
+ def self.openapi_nullable
77
+ Set.new([
78
+ ])
79
+ end
80
+
81
+ # Initializes the object
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ def initialize(attributes = {})
84
+ if (!attributes.is_a?(Hash))
85
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbItemPricingRequest` initialize method"
86
+ end
87
+
88
+ # check to see if the attribute exists and convert string to symbol for hash key
89
+ attributes = attributes.each_with_object({}) { |(k, v), h|
90
+ if (!self.class.attribute_map.key?(k.to_sym))
91
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbItemPricingRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
92
+ end
93
+ h[k.to_sym] = v
94
+ }
95
+
96
+ if attributes.key?(:'clear_msrp')
97
+ self.clear_msrp = attributes[:'clear_msrp']
98
+ end
99
+
100
+ if attributes.key?(:'clear_sale')
101
+ self.clear_sale = attributes[:'clear_sale']
102
+ end
103
+
104
+ if attributes.key?(:'cost')
105
+ self.cost = attributes[:'cost']
106
+ end
107
+
108
+ if attributes.key?(:'msrp')
109
+ self.msrp = attributes[:'msrp']
110
+ end
111
+
112
+ if attributes.key?(:'sale_cost')
113
+ self.sale_cost = attributes[:'sale_cost']
114
+ end
115
+
116
+ if attributes.key?(:'sale_end')
117
+ self.sale_end = attributes[:'sale_end']
118
+ end
119
+
120
+ if attributes.key?(:'sale_start')
121
+ self.sale_start = attributes[:'sale_start']
122
+ end
123
+
124
+ if attributes.key?(:'volume_discounts')
125
+ if (value = attributes[:'volume_discounts']).is_a?(Array)
126
+ self.volume_discounts = value
127
+ end
128
+ end
129
+ end
130
+
131
+ # Show invalid properties with the reasons. Usually used together with valid?
132
+ # @return Array for valid properties with the reasons
133
+ def list_invalid_properties
134
+ invalid_properties = Array.new
135
+ invalid_properties
136
+ end
137
+
138
+ # Check to see if the all the properties in the model are valid
139
+ # @return true if the model is valid
140
+ def valid?
141
+ true
142
+ end
143
+
144
+ # Checks equality by comparing each attribute.
145
+ # @param [Object] Object to be compared
146
+ def ==(o)
147
+ return true if self.equal?(o)
148
+ self.class == o.class &&
149
+ clear_msrp == o.clear_msrp &&
150
+ clear_sale == o.clear_sale &&
151
+ cost == o.cost &&
152
+ msrp == o.msrp &&
153
+ sale_cost == o.sale_cost &&
154
+ sale_end == o.sale_end &&
155
+ sale_start == o.sale_start &&
156
+ volume_discounts == o.volume_discounts
157
+ end
158
+
159
+ # @see the `==` method
160
+ # @param [Object] Object to be compared
161
+ def eql?(o)
162
+ self == o
163
+ end
164
+
165
+ # Calculates hash code according to all attributes.
166
+ # @return [Integer] Hash code
167
+ def hash
168
+ [clear_msrp, clear_sale, cost, msrp, sale_cost, sale_end, sale_start, volume_discounts].hash
169
+ end
170
+
171
+ # Builds the object from hash
172
+ # @param [Hash] attributes Model attributes in the form of hash
173
+ # @return [Object] Returns the model itself
174
+ def self.build_from_hash(attributes)
175
+ new.build_from_hash(attributes)
176
+ end
177
+
178
+ # Builds the object from hash
179
+ # @param [Hash] attributes Model attributes in the form of hash
180
+ # @return [Object] Returns the model itself
181
+ def build_from_hash(attributes)
182
+ return nil unless attributes.is_a?(Hash)
183
+ attributes = attributes.transform_keys(&:to_sym)
184
+ self.class.openapi_types.each_pair do |key, type|
185
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
186
+ self.send("#{key}=", nil)
187
+ elsif type =~ /\AArray<(.*)>/i
188
+ # check to ensure the input is an array given that the attribute
189
+ # is documented as an array but the input is not
190
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
191
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
192
+ end
193
+ elsif !attributes[self.class.attribute_map[key]].nil?
194
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
195
+ end
196
+ end
197
+
198
+ self
199
+ end
200
+
201
+ # Deserializes the data based on type
202
+ # @param string type Data type
203
+ # @param string value Value to be deserialized
204
+ # @return [Object] Deserialized data
205
+ def _deserialize(type, value)
206
+ case type.to_sym
207
+ when :Time
208
+ Time.parse(value)
209
+ when :Date
210
+ Date.parse(value)
211
+ when :String
212
+ value.to_s
213
+ when :Integer
214
+ value.to_i
215
+ when :Float
216
+ value.to_f
217
+ when :Boolean
218
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
219
+ true
220
+ else
221
+ false
222
+ end
223
+ when :Object
224
+ # generic object (usually a Hash), return directly
225
+ value
226
+ when /\AArray<(?<inner_type>.+)>\z/
227
+ inner_type = Regexp.last_match[:inner_type]
228
+ value.map { |v| _deserialize(inner_type, v) }
229
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
230
+ k_type = Regexp.last_match[:k_type]
231
+ v_type = Regexp.last_match[:v_type]
232
+ {}.tap do |hash|
233
+ value.each do |k, v|
234
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
235
+ end
236
+ end
237
+ else # model
238
+ # models (e.g. Pet) or oneOf
239
+ klass = UltracartClient.const_get(type)
240
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
241
+ end
242
+ end
243
+
244
+ # Returns the string representation of the object
245
+ # @return [String] String presentation of the object
246
+ def to_s
247
+ to_hash.to_s
248
+ end
249
+
250
+ # to_body is an alias to to_hash (backward compatibility)
251
+ # @return [Hash] Returns the object in the form of hash
252
+ def to_body
253
+ to_hash
254
+ end
255
+
256
+ # Returns the object in the form of hash
257
+ # @return [Hash] Returns the object in the form of hash
258
+ def to_hash
259
+ hash = {}
260
+ self.class.attribute_map.each_pair do |attr, param|
261
+ value = self.send(attr)
262
+ if value.nil?
263
+ is_nullable = self.class.openapi_nullable.include?(attr)
264
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
265
+ end
266
+
267
+ hash[param] = _to_hash(value)
268
+ end
269
+ hash
270
+ end
271
+
272
+ # Outputs non-array value in the form of hash
273
+ # For object, use to_hash. Otherwise, just return the value
274
+ # @param [Object] value Any valid value
275
+ # @return [Hash] Returns the value in the form of hash
276
+ def _to_hash(value)
277
+ if value.is_a?(Array)
278
+ value.compact.map { |v| _to_hash(v) }
279
+ elsif value.is_a?(Hash)
280
+ {}.tap do |hash|
281
+ value.each { |k, v| hash[k] = _to_hash(v) }
282
+ end
283
+ elsif value.respond_to? :to_hash
284
+ value.to_hash
285
+ else
286
+ value
287
+ end
288
+ end
289
+
290
+ end
291
+
292
+ end