wallee-ruby-sdk 7.0.0 → 8.0.0

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 (29) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +16 -16
  3. data/README.md +38 -1
  4. data/lib/wallee-ruby-sdk/api_client.rb +1 -1
  5. data/lib/wallee-ruby-sdk/models/charge_attempt_projection.rb +13 -4
  6. data/lib/wallee-ruby-sdk/models/express_checkout_session.rb +449 -0
  7. data/lib/wallee-ruby-sdk/models/express_checkout_session_create.rb +381 -0
  8. data/lib/wallee-ruby-sdk/models/express_checkout_session_create_response.rb +241 -0
  9. data/lib/wallee-ruby-sdk/models/express_checkout_session_process_request.rb +329 -0
  10. data/lib/wallee-ruby-sdk/models/express_checkout_session_process_response.rb +231 -0
  11. data/lib/wallee-ruby-sdk/models/express_checkout_session_state.rb +53 -0
  12. data/lib/wallee-ruby-sdk/models/express_checkout_shipping_option.rb +303 -0
  13. data/lib/wallee-ruby-sdk/models/express_checkout_wallet_type.rb +255 -0
  14. data/lib/wallee-ruby-sdk/models/fulfillment_state.rb +2 -1
  15. data/lib/wallee-ruby-sdk/models/merchant_application_submit_request_dto.rb +232 -0
  16. data/lib/wallee-ruby-sdk/models/merchant_application_submitted_dto.rb +273 -0
  17. data/lib/wallee-ruby-sdk/models/{payment_terminal_update.rb → payment_terminal_update_request.rb} +15 -41
  18. data/lib/wallee-ruby-sdk/models/subscription_partial_update_request.rb +250 -0
  19. data/lib/wallee-ruby-sdk/models/subscription_update_request.rb +45 -22
  20. data/lib/wallee-ruby-sdk/models/transaction_amounts.rb +257 -0
  21. data/lib/wallee-ruby-sdk/models/walleejoin_create_partnership_api_request_dto.rb +20 -1
  22. data/lib/wallee-ruby-sdk/service/express_checkout_session_service.rb +255 -0
  23. data/lib/wallee-ruby-sdk/service/merchant_applications_service.rb +151 -0
  24. data/lib/wallee-ruby-sdk/service/payment_terminals_service.rb +9 -9
  25. data/lib/wallee-ruby-sdk/service/subscriptions_service.rb +9 -9
  26. data/lib/wallee-ruby-sdk/version.rb +1 -1
  27. data/lib/wallee-ruby-sdk.rb +14 -1
  28. data/wallee-ruby-sdk.gemspec +3 -3
  29. metadata +962 -931
@@ -0,0 +1,381 @@
1
+ =begin
2
+ # Wallee AG Ruby SDK
3
+ #
4
+ # This library allows to interact with the Wallee AG payment service.
5
+ #
6
+ # Copyright owner: Wallee AG
7
+ # Website: https://en.wallee.com
8
+ # Developer email: ecosystem-team@wallee.com
9
+ #
10
+ # Licensed under the Apache License, Version 2.0 (the "License");
11
+ # you may not use this file except in compliance with the License.
12
+ # You may obtain a copy of the License at
13
+ #
14
+ # http://www.apache.org/licenses/LICENSE-2.0
15
+ #
16
+ # Unless required by applicable law or agreed to in writing, software
17
+ # distributed under the License is distributed on an "AS IS" BASIS,
18
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ # See the License for the specific language governing permissions and
20
+ # limitations under the License.
21
+ =end
22
+
23
+ require 'date'
24
+ require 'time'
25
+
26
+ module WalleeRubySdk
27
+ class ExpressCheckoutSessionCreate
28
+ attr_accessor :line_items
29
+
30
+ # The URL to fetch the shipping options from.
31
+ attr_accessor :merchant_shipping_callback_url
32
+
33
+ # The base URL on the merchant shop used to create the order.
34
+ attr_accessor :merchant_redirect_url
35
+
36
+ attr_accessor :authorization_environment
37
+
38
+ # Customer time zone for presentation and cutoffs (same semantics as on Transaction).
39
+ attr_accessor :time_zone
40
+
41
+ # The currency of the session.
42
+ attr_accessor :currency
43
+
44
+ # Preferred language for customer-facing content (same semantics as on Transaction).
45
+ attr_accessor :language
46
+
47
+ class EnumAttributeValidator
48
+ attr_reader :datatype
49
+ attr_reader :allowable_values
50
+
51
+ def initialize(datatype, allowable_values)
52
+ @allowable_values = allowable_values.map do |value|
53
+ case datatype.to_s
54
+ when /Integer/i
55
+ value.to_i
56
+ when /Float/i
57
+ value.to_f
58
+ else
59
+ value
60
+ end
61
+ end
62
+ end
63
+
64
+ def valid?(value)
65
+ !value || allowable_values.include?(value)
66
+ end
67
+ end
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ :'line_items' => :'lineItems',
73
+ :'merchant_shipping_callback_url' => :'merchantShippingCallbackUrl',
74
+ :'merchant_redirect_url' => :'merchantRedirectUrl',
75
+ :'authorization_environment' => :'authorizationEnvironment',
76
+ :'time_zone' => :'timeZone',
77
+ :'currency' => :'currency',
78
+ :'language' => :'language'
79
+ }
80
+ end
81
+
82
+ # Returns attribute mapping this model knows about
83
+ def self.acceptable_attribute_map
84
+ attribute_map
85
+ end
86
+
87
+ # Returns all the JSON keys this model knows about
88
+ def self.acceptable_attributes
89
+ acceptable_attribute_map.values
90
+ end
91
+
92
+ # Attribute type mapping.
93
+ def self.openapi_types
94
+ {
95
+ :'line_items' => :'Array<LineItem>',
96
+ :'merchant_shipping_callback_url' => :'String',
97
+ :'merchant_redirect_url' => :'String',
98
+ :'authorization_environment' => :'ChargeAttemptEnvironment',
99
+ :'time_zone' => :'String',
100
+ :'currency' => :'String',
101
+ :'language' => :'String'
102
+ }
103
+ end
104
+
105
+ # List of attributes with nullable: true
106
+ def self.openapi_nullable
107
+ Set.new([
108
+ ])
109
+ end
110
+
111
+ # Initializes the object
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ def initialize(attributes = {})
114
+ if (!attributes.is_a?(Hash))
115
+ fail ArgumentError, "The input argument (attributes) must be a hash in `WalleeRubySdk::ExpressCheckoutSessionCreate` initialize method"
116
+ end
117
+
118
+ # check to see if the attribute exists and convert string to symbol for hash key
119
+ acceptable_attribute_map = self.class.acceptable_attribute_map
120
+ attributes = attributes.each_with_object({}) { |(k, v), h|
121
+ if (!acceptable_attribute_map.key?(k.to_sym))
122
+ fail ArgumentError, "`#{k}` is not a valid attribute in `WalleeRubySdk::ExpressCheckoutSessionCreate`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
123
+ end
124
+ h[k.to_sym] = v
125
+ }
126
+
127
+ if attributes.key?(:'line_items')
128
+ if (value = attributes[:'line_items']).is_a?(Array)
129
+ self.line_items = value
130
+ end
131
+ else
132
+ self.line_items = nil
133
+ end
134
+
135
+ if attributes.key?(:'merchant_shipping_callback_url')
136
+ self.merchant_shipping_callback_url = attributes[:'merchant_shipping_callback_url']
137
+ end
138
+
139
+ if attributes.key?(:'merchant_redirect_url')
140
+ self.merchant_redirect_url = attributes[:'merchant_redirect_url']
141
+ else
142
+ self.merchant_redirect_url = nil
143
+ end
144
+
145
+ if attributes.key?(:'authorization_environment')
146
+ self.authorization_environment = attributes[:'authorization_environment']
147
+ else
148
+ self.authorization_environment = nil
149
+ end
150
+
151
+ if attributes.key?(:'time_zone')
152
+ self.time_zone = attributes[:'time_zone']
153
+ end
154
+
155
+ if attributes.key?(:'currency')
156
+ self.currency = attributes[:'currency']
157
+ else
158
+ self.currency = nil
159
+ end
160
+
161
+ if attributes.key?(:'language')
162
+ self.language = attributes[:'language']
163
+ end
164
+ end
165
+
166
+ # Show invalid properties with the reasons. Usually used together with valid?
167
+ # @return Array for valid properties with the reasons
168
+ def list_invalid_properties
169
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
170
+ invalid_properties = Array.new
171
+ if @line_items.nil?
172
+ invalid_properties.push('invalid value for "line_items", line_items cannot be nil.')
173
+ end
174
+
175
+ if @merchant_redirect_url.nil?
176
+ invalid_properties.push('invalid value for "merchant_redirect_url", merchant_redirect_url cannot be nil.')
177
+ end
178
+
179
+ if @authorization_environment.nil?
180
+ invalid_properties.push('invalid value for "authorization_environment", authorization_environment cannot be nil.')
181
+ end
182
+
183
+ if @currency.nil?
184
+ invalid_properties.push('invalid value for "currency", currency cannot be nil.')
185
+ end
186
+
187
+ invalid_properties
188
+ end
189
+
190
+ # Check to see if the all the properties in the model are valid
191
+ # @return true if the model is valid
192
+ def valid?
193
+ warn '[DEPRECATED] the `valid?` method is obsolete'
194
+ return false if @line_items.nil?
195
+ return false if @merchant_redirect_url.nil?
196
+ return false if @authorization_environment.nil?
197
+ return false if @currency.nil?
198
+ true
199
+ end
200
+
201
+ # Custom attribute writer method with validation
202
+ # @param [Object] line_items Value to be assigned
203
+ def line_items=(line_items)
204
+ if line_items.nil?
205
+ fail ArgumentError, 'line_items cannot be nil'
206
+ end
207
+
208
+ @line_items = line_items
209
+ end
210
+
211
+ # Custom attribute writer method with validation
212
+ # @param [Object] merchant_redirect_url Value to be assigned
213
+ def merchant_redirect_url=(merchant_redirect_url)
214
+ if merchant_redirect_url.nil?
215
+ fail ArgumentError, 'merchant_redirect_url cannot be nil'
216
+ end
217
+
218
+ @merchant_redirect_url = merchant_redirect_url
219
+ end
220
+
221
+ # Custom attribute writer method with validation
222
+ # @param [Object] authorization_environment Value to be assigned
223
+ def authorization_environment=(authorization_environment)
224
+ if authorization_environment.nil?
225
+ fail ArgumentError, 'authorization_environment cannot be nil'
226
+ end
227
+
228
+ @authorization_environment = authorization_environment
229
+ end
230
+
231
+ # Custom attribute writer method with validation
232
+ # @param [Object] currency Value to be assigned
233
+ def currency=(currency)
234
+ if currency.nil?
235
+ fail ArgumentError, 'currency cannot be nil'
236
+ end
237
+
238
+ @currency = currency
239
+ end
240
+
241
+ # Checks equality by comparing each attribute.
242
+ # @param [Object] Object to be compared
243
+ def ==(o)
244
+ return true if self.equal?(o)
245
+ self.class == o.class &&
246
+ line_items == o.line_items &&
247
+ merchant_shipping_callback_url == o.merchant_shipping_callback_url &&
248
+ merchant_redirect_url == o.merchant_redirect_url &&
249
+ authorization_environment == o.authorization_environment &&
250
+ time_zone == o.time_zone &&
251
+ currency == o.currency &&
252
+ language == o.language
253
+ end
254
+
255
+ # @see the `==` method
256
+ # @param [Object] Object to be compared
257
+ def eql?(o)
258
+ self == o
259
+ end
260
+
261
+ # Calculates hash code according to all attributes.
262
+ # @return [Integer] Hash code
263
+ def hash
264
+ [line_items, merchant_shipping_callback_url, merchant_redirect_url, authorization_environment, time_zone, currency, language].hash
265
+ end
266
+
267
+ # Builds the object from hash
268
+ # @param [Hash] attributes Model attributes in the form of hash
269
+ # @return [Object] Returns the model itself
270
+ def self.build_from_hash(attributes)
271
+ return nil unless attributes.is_a?(Hash)
272
+ attributes = attributes.transform_keys(&:to_sym)
273
+ transformed_hash = {}
274
+ openapi_types.each_pair do |key, type|
275
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
276
+ transformed_hash["#{key}"] = nil
277
+ elsif type =~ /\AArray<(.*)>/i
278
+ # check to ensure the input is an array given that the attribute
279
+ # is documented as an array but the input is not
280
+ if attributes[attribute_map[key]].is_a?(Array)
281
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
282
+ end
283
+ elsif !attributes[attribute_map[key]].nil?
284
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
285
+ end
286
+ end
287
+ new(transformed_hash)
288
+ end
289
+
290
+ # Deserializes the data based on type
291
+ # @param string type Data type
292
+ # @param string value Value to be deserialized
293
+ # @return [Object] Deserialized data
294
+ def self._deserialize(type, value)
295
+ case type.to_sym
296
+ when :Time
297
+ Time.parse(value)
298
+ when :Date
299
+ Date.parse(value)
300
+ when :String
301
+ value.to_s
302
+ when :Integer
303
+ value.to_i
304
+ when :Float
305
+ value.to_f
306
+ when :Boolean
307
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
308
+ true
309
+ else
310
+ false
311
+ end
312
+ when :Object
313
+ # generic object (usually a Hash), return directly
314
+ value
315
+ when /\AArray<(?<inner_type>.+)>\z/
316
+ inner_type = Regexp.last_match[:inner_type]
317
+ value.map { |v| _deserialize(inner_type, v) }
318
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
319
+ k_type = Regexp.last_match[:k_type]
320
+ v_type = Regexp.last_match[:v_type]
321
+ {}.tap do |hash|
322
+ value.each do |k, v|
323
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
324
+ end
325
+ end
326
+ else # model
327
+ # models (e.g. Pet) or oneOf
328
+ klass = WalleeRubySdk.const_get(type)
329
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
330
+ end
331
+ end
332
+
333
+ # Returns the string representation of the object
334
+ # @return [String] String presentation of the object
335
+ def to_s
336
+ to_hash.to_s
337
+ end
338
+
339
+ # to_body is an alias to to_hash (backward compatibility)
340
+ # @return [Hash] Returns the object in the form of hash
341
+ def to_body
342
+ to_hash
343
+ end
344
+
345
+ # Returns the object in the form of hash
346
+ # @return [Hash] Returns the object in the form of hash
347
+ def to_hash
348
+ hash = {}
349
+ self.class.attribute_map.each_pair do |attr, param|
350
+ value = self.send(attr)
351
+ if value.nil?
352
+ is_nullable = self.class.openapi_nullable.include?(attr)
353
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
354
+ end
355
+
356
+ hash[param] = _to_hash(value)
357
+ end
358
+ hash
359
+ end
360
+
361
+ # Outputs non-array value in the form of hash
362
+ # For object, use to_hash. Otherwise, just return the value
363
+ # @param [Object] value Any valid value
364
+ # @return [Hash] Returns the value in the form of hash
365
+ def _to_hash(value)
366
+ if value.is_a?(Array)
367
+ value.compact.map { |v| _to_hash(v) }
368
+ elsif value.is_a?(Hash)
369
+ {}.tap do |hash|
370
+ value.each { |k, v| hash[k] = _to_hash(v) }
371
+ end
372
+ elsif value.respond_to? :to_hash
373
+ value.to_hash
374
+ else
375
+ value
376
+ end
377
+ end
378
+
379
+ end
380
+
381
+ end
@@ -0,0 +1,241 @@
1
+ =begin
2
+ # Wallee AG Ruby SDK
3
+ #
4
+ # This library allows to interact with the Wallee AG payment service.
5
+ #
6
+ # Copyright owner: Wallee AG
7
+ # Website: https://en.wallee.com
8
+ # Developer email: ecosystem-team@wallee.com
9
+ #
10
+ # Licensed under the Apache License, Version 2.0 (the "License");
11
+ # you may not use this file except in compliance with the License.
12
+ # You may obtain a copy of the License at
13
+ #
14
+ # http://www.apache.org/licenses/LICENSE-2.0
15
+ #
16
+ # Unless required by applicable law or agreed to in writing, software
17
+ # distributed under the License is distributed on an "AS IS" BASIS,
18
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ # See the License for the specific language governing permissions and
20
+ # limitations under the License.
21
+ =end
22
+
23
+ require 'date'
24
+ require 'time'
25
+
26
+ module WalleeRubySdk
27
+ class ExpressCheckoutSessionCreateResponse
28
+ # Security token used to render the widget and continue the checkout flow.
29
+ attr_accessor :session_token
30
+
31
+ # Identifier of the newly created Express Checkout session.
32
+ attr_accessor :session_id
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'session_token' => :'sessionToken',
38
+ :'session_id' => :'sessionId'
39
+ }
40
+ end
41
+
42
+ # Returns attribute mapping this model knows about
43
+ def self.acceptable_attribute_map
44
+ attribute_map
45
+ end
46
+
47
+ # Returns all the JSON keys this model knows about
48
+ def self.acceptable_attributes
49
+ acceptable_attribute_map.values
50
+ end
51
+
52
+ # Attribute type mapping.
53
+ def self.openapi_types
54
+ {
55
+ :'session_token' => :'String',
56
+ :'session_id' => :'Integer'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `WalleeRubySdk::ExpressCheckoutSessionCreateResponse` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ acceptable_attribute_map = self.class.acceptable_attribute_map
75
+ attributes = attributes.each_with_object({}) { |(k, v), h|
76
+ if (!acceptable_attribute_map.key?(k.to_sym))
77
+ fail ArgumentError, "`#{k}` is not a valid attribute in `WalleeRubySdk::ExpressCheckoutSessionCreateResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
78
+ end
79
+ h[k.to_sym] = v
80
+ }
81
+
82
+ if attributes.key?(:'session_token')
83
+ self.session_token = attributes[:'session_token']
84
+ end
85
+
86
+ if attributes.key?(:'session_id')
87
+ self.session_id = attributes[:'session_id']
88
+ end
89
+ end
90
+
91
+ # Show invalid properties with the reasons. Usually used together with valid?
92
+ # @return Array for valid properties with the reasons
93
+ def list_invalid_properties
94
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
95
+ invalid_properties = Array.new
96
+ invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ warn '[DEPRECATED] the `valid?` method is obsolete'
103
+ true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ session_token == o.session_token &&
112
+ session_id == o.session_id
113
+ end
114
+
115
+ # @see the `==` method
116
+ # @param [Object] Object to be compared
117
+ def eql?(o)
118
+ self == o
119
+ end
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Integer] Hash code
123
+ def hash
124
+ [session_token, session_id].hash
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def self.build_from_hash(attributes)
131
+ return nil unless attributes.is_a?(Hash)
132
+ attributes = attributes.transform_keys(&:to_sym)
133
+ transformed_hash = {}
134
+ openapi_types.each_pair do |key, type|
135
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
136
+ transformed_hash["#{key}"] = nil
137
+ elsif type =~ /\AArray<(.*)>/i
138
+ # check to ensure the input is an array given that the attribute
139
+ # is documented as an array but the input is not
140
+ if attributes[attribute_map[key]].is_a?(Array)
141
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
142
+ end
143
+ elsif !attributes[attribute_map[key]].nil?
144
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
145
+ end
146
+ end
147
+ new(transformed_hash)
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def self._deserialize(type, value)
155
+ case type.to_sym
156
+ when :Time
157
+ Time.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :Boolean
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ # models (e.g. Pet) or oneOf
188
+ klass = WalleeRubySdk.const_get(type)
189
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ # Outputs non-array value in the form of hash
222
+ # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map { |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end
238
+
239
+ end
240
+
241
+ end