ultracart_api 4.1.259 → 4.1.261

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