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,280 @@
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 SfvbItemAttributeBatchRow
18
+ # The current_sha256 the dry run answered for this row. Required to apply; a row whose value changed since is skipped as stale.
19
+ attr_accessor :current_sha256
20
+
21
+ # For a dry run, the value the caller believes the item holds now. A different current value makes the row stale.
22
+ attr_accessor :expected_value
23
+
24
+ # The item by its merchant item id, for a dry run. Send this or merchant_item_oid, not both.
25
+ attr_accessor :merchant_item_id
26
+
27
+ # The item. Required to apply; the dry run answers it for a row that named merchant_item_id.
28
+ attr_accessor :merchant_item_oid
29
+
30
+ # The attribute name, matched without regard to case.
31
+ attr_accessor :name
32
+
33
+ # The attribute type, used only when no template on the item's pages declares the name.
34
+ attr_accessor :type
35
+
36
+ # The new value. An empty string clears the attribute.
37
+ attr_accessor :value
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
40
+ def self.attribute_map
41
+ {
42
+ :'current_sha256' => :'current_sha256',
43
+ :'expected_value' => :'expected_value',
44
+ :'merchant_item_id' => :'merchant_item_id',
45
+ :'merchant_item_oid' => :'merchant_item_oid',
46
+ :'name' => :'name',
47
+ :'type' => :'type',
48
+ :'value' => :'value'
49
+ }
50
+ end
51
+
52
+ # Returns all the JSON keys this model knows about
53
+ def self.acceptable_attributes
54
+ attribute_map.values
55
+ end
56
+
57
+ # Attribute type mapping.
58
+ def self.openapi_types
59
+ {
60
+ :'current_sha256' => :'String',
61
+ :'expected_value' => :'String',
62
+ :'merchant_item_id' => :'String',
63
+ :'merchant_item_oid' => :'Integer',
64
+ :'name' => :'String',
65
+ :'type' => :'String',
66
+ :'value' => :'String'
67
+ }
68
+ end
69
+
70
+ # List of attributes with nullable: true
71
+ def self.openapi_nullable
72
+ Set.new([
73
+ ])
74
+ end
75
+
76
+ # Initializes the object
77
+ # @param [Hash] attributes Model attributes in the form of hash
78
+ def initialize(attributes = {})
79
+ if (!attributes.is_a?(Hash))
80
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbItemAttributeBatchRow` initialize method"
81
+ end
82
+
83
+ # check to see if the attribute exists and convert string to symbol for hash key
84
+ attributes = attributes.each_with_object({}) { |(k, v), h|
85
+ if (!self.class.attribute_map.key?(k.to_sym))
86
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbItemAttributeBatchRow`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
87
+ end
88
+ h[k.to_sym] = v
89
+ }
90
+
91
+ if attributes.key?(:'current_sha256')
92
+ self.current_sha256 = attributes[:'current_sha256']
93
+ end
94
+
95
+ if attributes.key?(:'expected_value')
96
+ self.expected_value = attributes[:'expected_value']
97
+ end
98
+
99
+ if attributes.key?(:'merchant_item_id')
100
+ self.merchant_item_id = attributes[:'merchant_item_id']
101
+ end
102
+
103
+ if attributes.key?(:'merchant_item_oid')
104
+ self.merchant_item_oid = attributes[:'merchant_item_oid']
105
+ end
106
+
107
+ if attributes.key?(:'name')
108
+ self.name = attributes[:'name']
109
+ end
110
+
111
+ if attributes.key?(:'type')
112
+ self.type = attributes[:'type']
113
+ end
114
+
115
+ if attributes.key?(:'value')
116
+ self.value = attributes[:'value']
117
+ end
118
+ end
119
+
120
+ # Show invalid properties with the reasons. Usually used together with valid?
121
+ # @return Array for valid properties with the reasons
122
+ def list_invalid_properties
123
+ invalid_properties = Array.new
124
+ invalid_properties
125
+ end
126
+
127
+ # Check to see if the all the properties in the model are valid
128
+ # @return true if the model is valid
129
+ def valid?
130
+ true
131
+ end
132
+
133
+ # Checks equality by comparing each attribute.
134
+ # @param [Object] Object to be compared
135
+ def ==(o)
136
+ return true if self.equal?(o)
137
+ self.class == o.class &&
138
+ current_sha256 == o.current_sha256 &&
139
+ expected_value == o.expected_value &&
140
+ merchant_item_id == o.merchant_item_id &&
141
+ merchant_item_oid == o.merchant_item_oid &&
142
+ name == o.name &&
143
+ type == o.type &&
144
+ value == o.value
145
+ end
146
+
147
+ # @see the `==` method
148
+ # @param [Object] Object to be compared
149
+ def eql?(o)
150
+ self == o
151
+ end
152
+
153
+ # Calculates hash code according to all attributes.
154
+ # @return [Integer] Hash code
155
+ def hash
156
+ [current_sha256, expected_value, merchant_item_id, merchant_item_oid, name, type, value].hash
157
+ end
158
+
159
+ # Builds the object from hash
160
+ # @param [Hash] attributes Model attributes in the form of hash
161
+ # @return [Object] Returns the model itself
162
+ def self.build_from_hash(attributes)
163
+ new.build_from_hash(attributes)
164
+ end
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def build_from_hash(attributes)
170
+ return nil unless attributes.is_a?(Hash)
171
+ attributes = attributes.transform_keys(&:to_sym)
172
+ self.class.openapi_types.each_pair do |key, type|
173
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
174
+ self.send("#{key}=", nil)
175
+ elsif type =~ /\AArray<(.*)>/i
176
+ # check to ensure the input is an array given that the attribute
177
+ # is documented as an array but the input is not
178
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
179
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
180
+ end
181
+ elsif !attributes[self.class.attribute_map[key]].nil?
182
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
183
+ end
184
+ end
185
+
186
+ self
187
+ end
188
+
189
+ # Deserializes the data based on type
190
+ # @param string type Data type
191
+ # @param string value Value to be deserialized
192
+ # @return [Object] Deserialized data
193
+ def _deserialize(type, value)
194
+ case type.to_sym
195
+ when :Time
196
+ Time.parse(value)
197
+ when :Date
198
+ Date.parse(value)
199
+ when :String
200
+ value.to_s
201
+ when :Integer
202
+ value.to_i
203
+ when :Float
204
+ value.to_f
205
+ when :Boolean
206
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
207
+ true
208
+ else
209
+ false
210
+ end
211
+ when :Object
212
+ # generic object (usually a Hash), return directly
213
+ value
214
+ when /\AArray<(?<inner_type>.+)>\z/
215
+ inner_type = Regexp.last_match[:inner_type]
216
+ value.map { |v| _deserialize(inner_type, v) }
217
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
218
+ k_type = Regexp.last_match[:k_type]
219
+ v_type = Regexp.last_match[:v_type]
220
+ {}.tap do |hash|
221
+ value.each do |k, v|
222
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
223
+ end
224
+ end
225
+ else # model
226
+ # models (e.g. Pet) or oneOf
227
+ klass = UltracartClient.const_get(type)
228
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
229
+ end
230
+ end
231
+
232
+ # Returns the string representation of the object
233
+ # @return [String] String presentation of the object
234
+ def to_s
235
+ to_hash.to_s
236
+ end
237
+
238
+ # to_body is an alias to to_hash (backward compatibility)
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_body
241
+ to_hash
242
+ end
243
+
244
+ # Returns the object in the form of hash
245
+ # @return [Hash] Returns the object in the form of hash
246
+ def to_hash
247
+ hash = {}
248
+ self.class.attribute_map.each_pair do |attr, param|
249
+ value = self.send(attr)
250
+ if value.nil?
251
+ is_nullable = self.class.openapi_nullable.include?(attr)
252
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
253
+ end
254
+
255
+ hash[param] = _to_hash(value)
256
+ end
257
+ hash
258
+ end
259
+
260
+ # Outputs non-array value in the form of hash
261
+ # For object, use to_hash. Otherwise, just return the value
262
+ # @param [Object] value Any valid value
263
+ # @return [Hash] Returns the value in the form of hash
264
+ def _to_hash(value)
265
+ if value.is_a?(Array)
266
+ value.compact.map { |v| _to_hash(v) }
267
+ elsif value.is_a?(Hash)
268
+ {}.tap do |hash|
269
+ value.each { |k, v| hash[k] = _to_hash(v) }
270
+ end
271
+ elsif value.respond_to? :to_hash
272
+ value.to_hash
273
+ else
274
+ value
275
+ end
276
+ end
277
+
278
+ end
279
+
280
+ end
@@ -0,0 +1,344 @@
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 SfvbItemAttributeBatchRowResult
18
+ # Whether the item had the attribute before this batch.
19
+ attr_accessor :current_present
20
+
21
+ # The hash of the value before this batch. Send it back with the row to apply.
22
+ attr_accessor :current_sha256
23
+
24
+ # The value before this batch, for a backup. Empty when the item has no such attribute.
25
+ attr_accessor :current_value
26
+
27
+ # The item's merchant item id. Absent when not_found.
28
+ attr_accessor :merchant_item_id
29
+
30
+ # The item. Absent when not_found.
31
+ attr_accessor :merchant_item_oid
32
+
33
+ # Why a row is invalid, stale or error.
34
+ attr_accessor :message
35
+
36
+ # The attribute name as sent.
37
+ attr_accessor :name
38
+
39
+ # change or unchanged from a dry run, updated after an apply, stale (the value differs from expected_value or changed since the dry run), not_found, invalid, or error when the item could not be saved.
40
+ attr_accessor :result
41
+
42
+ # The row's position in the request, from 1.
43
+ attr_accessor :row
44
+
45
+ # The type the value is checked and stored as - the declaring template's, else the one sent.
46
+ attr_accessor :type
47
+
48
+ class EnumAttributeValidator
49
+ attr_reader :datatype
50
+ attr_reader :allowable_values
51
+
52
+ def initialize(datatype, allowable_values)
53
+ @allowable_values = allowable_values.map do |value|
54
+ case datatype.to_s
55
+ when /Integer/i
56
+ value.to_i
57
+ when /Float/i
58
+ value.to_f
59
+ else
60
+ value
61
+ end
62
+ end
63
+ end
64
+
65
+ def valid?(value)
66
+ !value || allowable_values.include?(value)
67
+ end
68
+ end
69
+
70
+ # Attribute mapping from ruby-style variable name to JSON key.
71
+ def self.attribute_map
72
+ {
73
+ :'current_present' => :'current_present',
74
+ :'current_sha256' => :'current_sha256',
75
+ :'current_value' => :'current_value',
76
+ :'merchant_item_id' => :'merchant_item_id',
77
+ :'merchant_item_oid' => :'merchant_item_oid',
78
+ :'message' => :'message',
79
+ :'name' => :'name',
80
+ :'result' => :'result',
81
+ :'row' => :'row',
82
+ :'type' => :'type'
83
+ }
84
+ end
85
+
86
+ # Returns all the JSON keys this model knows about
87
+ def self.acceptable_attributes
88
+ attribute_map.values
89
+ end
90
+
91
+ # Attribute type mapping.
92
+ def self.openapi_types
93
+ {
94
+ :'current_present' => :'Boolean',
95
+ :'current_sha256' => :'String',
96
+ :'current_value' => :'String',
97
+ :'merchant_item_id' => :'String',
98
+ :'merchant_item_oid' => :'Integer',
99
+ :'message' => :'String',
100
+ :'name' => :'String',
101
+ :'result' => :'String',
102
+ :'row' => :'Integer',
103
+ :'type' => :'String'
104
+ }
105
+ end
106
+
107
+ # List of attributes with nullable: true
108
+ def self.openapi_nullable
109
+ Set.new([
110
+ ])
111
+ end
112
+
113
+ # Initializes the object
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ def initialize(attributes = {})
116
+ if (!attributes.is_a?(Hash))
117
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbItemAttributeBatchRowResult` initialize method"
118
+ end
119
+
120
+ # check to see if the attribute exists and convert string to symbol for hash key
121
+ attributes = attributes.each_with_object({}) { |(k, v), h|
122
+ if (!self.class.attribute_map.key?(k.to_sym))
123
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbItemAttributeBatchRowResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
124
+ end
125
+ h[k.to_sym] = v
126
+ }
127
+
128
+ if attributes.key?(:'current_present')
129
+ self.current_present = attributes[:'current_present']
130
+ end
131
+
132
+ if attributes.key?(:'current_sha256')
133
+ self.current_sha256 = attributes[:'current_sha256']
134
+ end
135
+
136
+ if attributes.key?(:'current_value')
137
+ self.current_value = attributes[:'current_value']
138
+ end
139
+
140
+ if attributes.key?(:'merchant_item_id')
141
+ self.merchant_item_id = attributes[:'merchant_item_id']
142
+ end
143
+
144
+ if attributes.key?(:'merchant_item_oid')
145
+ self.merchant_item_oid = attributes[:'merchant_item_oid']
146
+ end
147
+
148
+ if attributes.key?(:'message')
149
+ self.message = attributes[:'message']
150
+ end
151
+
152
+ if attributes.key?(:'name')
153
+ self.name = attributes[:'name']
154
+ end
155
+
156
+ if attributes.key?(:'result')
157
+ self.result = attributes[:'result']
158
+ end
159
+
160
+ if attributes.key?(:'row')
161
+ self.row = attributes[:'row']
162
+ end
163
+
164
+ if attributes.key?(:'type')
165
+ self.type = attributes[:'type']
166
+ end
167
+ end
168
+
169
+ # Show invalid properties with the reasons. Usually used together with valid?
170
+ # @return Array for valid properties with the reasons
171
+ def list_invalid_properties
172
+ invalid_properties = Array.new
173
+ invalid_properties
174
+ end
175
+
176
+ # Check to see if the all the properties in the model are valid
177
+ # @return true if the model is valid
178
+ def valid?
179
+ result_validator = EnumAttributeValidator.new('String', ["change", "unchanged", "updated", "stale", "not_found", "invalid", "error"])
180
+ return false unless result_validator.valid?(@result)
181
+ true
182
+ end
183
+
184
+ # Custom attribute writer method checking allowed values (enum).
185
+ # @param [Object] result Object to be assigned
186
+ def result=(result)
187
+ validator = EnumAttributeValidator.new('String', ["change", "unchanged", "updated", "stale", "not_found", "invalid", "error"])
188
+ unless validator.valid?(result)
189
+ fail ArgumentError, "invalid value for \"result\", must be one of #{validator.allowable_values}."
190
+ end
191
+ @result = result
192
+ end
193
+
194
+ # Checks equality by comparing each attribute.
195
+ # @param [Object] Object to be compared
196
+ def ==(o)
197
+ return true if self.equal?(o)
198
+ self.class == o.class &&
199
+ current_present == o.current_present &&
200
+ current_sha256 == o.current_sha256 &&
201
+ current_value == o.current_value &&
202
+ merchant_item_id == o.merchant_item_id &&
203
+ merchant_item_oid == o.merchant_item_oid &&
204
+ message == o.message &&
205
+ name == o.name &&
206
+ result == o.result &&
207
+ row == o.row &&
208
+ type == o.type
209
+ end
210
+
211
+ # @see the `==` method
212
+ # @param [Object] Object to be compared
213
+ def eql?(o)
214
+ self == o
215
+ end
216
+
217
+ # Calculates hash code according to all attributes.
218
+ # @return [Integer] Hash code
219
+ def hash
220
+ [current_present, current_sha256, current_value, merchant_item_id, merchant_item_oid, message, name, result, row, type].hash
221
+ end
222
+
223
+ # Builds the object from hash
224
+ # @param [Hash] attributes Model attributes in the form of hash
225
+ # @return [Object] Returns the model itself
226
+ def self.build_from_hash(attributes)
227
+ new.build_from_hash(attributes)
228
+ end
229
+
230
+ # Builds the object from hash
231
+ # @param [Hash] attributes Model attributes in the form of hash
232
+ # @return [Object] Returns the model itself
233
+ def build_from_hash(attributes)
234
+ return nil unless attributes.is_a?(Hash)
235
+ attributes = attributes.transform_keys(&:to_sym)
236
+ self.class.openapi_types.each_pair do |key, type|
237
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
238
+ self.send("#{key}=", nil)
239
+ elsif type =~ /\AArray<(.*)>/i
240
+ # check to ensure the input is an array given that the attribute
241
+ # is documented as an array but the input is not
242
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
243
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
244
+ end
245
+ elsif !attributes[self.class.attribute_map[key]].nil?
246
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
247
+ end
248
+ end
249
+
250
+ self
251
+ end
252
+
253
+ # Deserializes the data based on type
254
+ # @param string type Data type
255
+ # @param string value Value to be deserialized
256
+ # @return [Object] Deserialized data
257
+ def _deserialize(type, value)
258
+ case type.to_sym
259
+ when :Time
260
+ Time.parse(value)
261
+ when :Date
262
+ Date.parse(value)
263
+ when :String
264
+ value.to_s
265
+ when :Integer
266
+ value.to_i
267
+ when :Float
268
+ value.to_f
269
+ when :Boolean
270
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
271
+ true
272
+ else
273
+ false
274
+ end
275
+ when :Object
276
+ # generic object (usually a Hash), return directly
277
+ value
278
+ when /\AArray<(?<inner_type>.+)>\z/
279
+ inner_type = Regexp.last_match[:inner_type]
280
+ value.map { |v| _deserialize(inner_type, v) }
281
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
282
+ k_type = Regexp.last_match[:k_type]
283
+ v_type = Regexp.last_match[:v_type]
284
+ {}.tap do |hash|
285
+ value.each do |k, v|
286
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
287
+ end
288
+ end
289
+ else # model
290
+ # models (e.g. Pet) or oneOf
291
+ klass = UltracartClient.const_get(type)
292
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
293
+ end
294
+ end
295
+
296
+ # Returns the string representation of the object
297
+ # @return [String] String presentation of the object
298
+ def to_s
299
+ to_hash.to_s
300
+ end
301
+
302
+ # to_body is an alias to to_hash (backward compatibility)
303
+ # @return [Hash] Returns the object in the form of hash
304
+ def to_body
305
+ to_hash
306
+ end
307
+
308
+ # Returns the object in the form of hash
309
+ # @return [Hash] Returns the object in the form of hash
310
+ def to_hash
311
+ hash = {}
312
+ self.class.attribute_map.each_pair do |attr, param|
313
+ value = self.send(attr)
314
+ if value.nil?
315
+ is_nullable = self.class.openapi_nullable.include?(attr)
316
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
317
+ end
318
+
319
+ hash[param] = _to_hash(value)
320
+ end
321
+ hash
322
+ end
323
+
324
+ # Outputs non-array value in the form of hash
325
+ # For object, use to_hash. Otherwise, just return the value
326
+ # @param [Object] value Any valid value
327
+ # @return [Hash] Returns the value in the form of hash
328
+ def _to_hash(value)
329
+ if value.is_a?(Array)
330
+ value.compact.map { |v| _to_hash(v) }
331
+ elsif value.is_a?(Hash)
332
+ {}.tap do |hash|
333
+ value.each { |k, v| hash[k] = _to_hash(v) }
334
+ end
335
+ elsif value.respond_to? :to_hash
336
+ value.to_hash
337
+ else
338
+ value
339
+ end
340
+ end
341
+
342
+ end
343
+
344
+ end