ultracart_api 4.1.102 → 4.1.103
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.
- checksums.yaml +4 -4
- data/README.md +15 -2
- data/docs/Affiliate.md +122 -0
- data/docs/AffiliateApi.md +277 -0
- data/docs/AffiliateAttribute.md +22 -0
- data/docs/AffiliateMarketingStrategy.md +38 -0
- data/docs/AffiliateQuery.md +38 -0
- data/docs/AffiliateResponse.md +26 -0
- data/docs/AffiliateTierRelationship.md +20 -0
- data/docs/AffiliatesResponse.md +26 -0
- data/lib/ultracart_api/api/affiliate_api.rb +359 -0
- data/lib/ultracart_api/models/affiliate.rb +804 -0
- data/lib/ultracart_api/models/affiliate_attribute.rb +240 -0
- data/lib/ultracart_api/models/affiliate_marketing_strategy.rb +320 -0
- data/lib/ultracart_api/models/affiliate_query.rb +489 -0
- data/lib/ultracart_api/models/affiliate_response.rb +256 -0
- data/lib/ultracart_api/models/affiliate_tier_relationship.rb +230 -0
- data/lib/ultracart_api/models/affiliates_response.rb +259 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +7 -0
- metadata +16 -2
|
@@ -0,0 +1,489 @@
|
|
|
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 AffiliateQuery
|
|
18
|
+
# Affiliate OID
|
|
19
|
+
attr_accessor :affiliate_oid
|
|
20
|
+
|
|
21
|
+
# City
|
|
22
|
+
attr_accessor :city
|
|
23
|
+
|
|
24
|
+
# Company name
|
|
25
|
+
attr_accessor :company_name
|
|
26
|
+
|
|
27
|
+
# ISO-3166 two letter country code
|
|
28
|
+
attr_accessor :country_code
|
|
29
|
+
|
|
30
|
+
# Email
|
|
31
|
+
attr_accessor :email
|
|
32
|
+
|
|
33
|
+
# First name
|
|
34
|
+
attr_accessor :first_name
|
|
35
|
+
|
|
36
|
+
# Last name
|
|
37
|
+
attr_accessor :last_name
|
|
38
|
+
|
|
39
|
+
# Postal code
|
|
40
|
+
attr_accessor :postal_code
|
|
41
|
+
|
|
42
|
+
# StoreFront short code
|
|
43
|
+
attr_accessor :short_code
|
|
44
|
+
|
|
45
|
+
# State for United States otherwise region or province for other countries
|
|
46
|
+
attr_accessor :state
|
|
47
|
+
|
|
48
|
+
# Status
|
|
49
|
+
attr_accessor :status
|
|
50
|
+
|
|
51
|
+
class EnumAttributeValidator
|
|
52
|
+
attr_reader :datatype
|
|
53
|
+
attr_reader :allowable_values
|
|
54
|
+
|
|
55
|
+
def initialize(datatype, allowable_values)
|
|
56
|
+
@allowable_values = allowable_values.map do |value|
|
|
57
|
+
case datatype.to_s
|
|
58
|
+
when /Integer/i
|
|
59
|
+
value.to_i
|
|
60
|
+
when /Float/i
|
|
61
|
+
value.to_f
|
|
62
|
+
else
|
|
63
|
+
value
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def valid?(value)
|
|
69
|
+
!value || allowable_values.include?(value)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
74
|
+
def self.attribute_map
|
|
75
|
+
{
|
|
76
|
+
:'affiliate_oid' => :'affiliate_oid',
|
|
77
|
+
:'city' => :'city',
|
|
78
|
+
:'company_name' => :'company_name',
|
|
79
|
+
:'country_code' => :'country_code',
|
|
80
|
+
:'email' => :'email',
|
|
81
|
+
:'first_name' => :'first_name',
|
|
82
|
+
:'last_name' => :'last_name',
|
|
83
|
+
:'postal_code' => :'postal_code',
|
|
84
|
+
:'short_code' => :'short_code',
|
|
85
|
+
:'state' => :'state',
|
|
86
|
+
:'status' => :'status'
|
|
87
|
+
}
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Returns all the JSON keys this model knows about
|
|
91
|
+
def self.acceptable_attributes
|
|
92
|
+
attribute_map.values
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Attribute type mapping.
|
|
96
|
+
def self.openapi_types
|
|
97
|
+
{
|
|
98
|
+
:'affiliate_oid' => :'Integer',
|
|
99
|
+
:'city' => :'String',
|
|
100
|
+
:'company_name' => :'String',
|
|
101
|
+
:'country_code' => :'String',
|
|
102
|
+
:'email' => :'String',
|
|
103
|
+
:'first_name' => :'String',
|
|
104
|
+
:'last_name' => :'String',
|
|
105
|
+
:'postal_code' => :'String',
|
|
106
|
+
:'short_code' => :'String',
|
|
107
|
+
:'state' => :'String',
|
|
108
|
+
:'status' => :'String'
|
|
109
|
+
}
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# List of attributes with nullable: true
|
|
113
|
+
def self.openapi_nullable
|
|
114
|
+
Set.new([
|
|
115
|
+
])
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Initializes the object
|
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
120
|
+
def initialize(attributes = {})
|
|
121
|
+
if (!attributes.is_a?(Hash))
|
|
122
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::AffiliateQuery` initialize method"
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
126
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
127
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
128
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::AffiliateQuery`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
129
|
+
end
|
|
130
|
+
h[k.to_sym] = v
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if attributes.key?(:'affiliate_oid')
|
|
134
|
+
self.affiliate_oid = attributes[:'affiliate_oid']
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if attributes.key?(:'city')
|
|
138
|
+
self.city = attributes[:'city']
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if attributes.key?(:'company_name')
|
|
142
|
+
self.company_name = attributes[:'company_name']
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if attributes.key?(:'country_code')
|
|
146
|
+
self.country_code = attributes[:'country_code']
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if attributes.key?(:'email')
|
|
150
|
+
self.email = attributes[:'email']
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if attributes.key?(:'first_name')
|
|
154
|
+
self.first_name = attributes[:'first_name']
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if attributes.key?(:'last_name')
|
|
158
|
+
self.last_name = attributes[:'last_name']
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if attributes.key?(:'postal_code')
|
|
162
|
+
self.postal_code = attributes[:'postal_code']
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
if attributes.key?(:'short_code')
|
|
166
|
+
self.short_code = attributes[:'short_code']
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
if attributes.key?(:'state')
|
|
170
|
+
self.state = attributes[:'state']
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
if attributes.key?(:'status')
|
|
174
|
+
self.status = attributes[:'status']
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
179
|
+
# @return Array for valid properties with the reasons
|
|
180
|
+
def list_invalid_properties
|
|
181
|
+
invalid_properties = Array.new
|
|
182
|
+
if !@city.nil? && @city.to_s.length > 50
|
|
183
|
+
invalid_properties.push('invalid value for "city", the character length must be smaller than or equal to 50.')
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
if !@company_name.nil? && @company_name.to_s.length > 100
|
|
187
|
+
invalid_properties.push('invalid value for "company_name", the character length must be smaller than or equal to 100.')
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
if !@country_code.nil? && @country_code.to_s.length > 2
|
|
191
|
+
invalid_properties.push('invalid value for "country_code", the character length must be smaller than or equal to 2.')
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
if !@email.nil? && @email.to_s.length > 150
|
|
195
|
+
invalid_properties.push('invalid value for "email", the character length must be smaller than or equal to 150.')
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
if !@first_name.nil? && @first_name.to_s.length > 50
|
|
199
|
+
invalid_properties.push('invalid value for "first_name", the character length must be smaller than or equal to 50.')
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
if !@last_name.nil? && @last_name.to_s.length > 50
|
|
203
|
+
invalid_properties.push('invalid value for "last_name", the character length must be smaller than or equal to 50.')
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
if !@postal_code.nil? && @postal_code.to_s.length > 15
|
|
207
|
+
invalid_properties.push('invalid value for "postal_code", the character length must be smaller than or equal to 15.')
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
if !@short_code.nil? && @short_code.to_s.length > 30
|
|
211
|
+
invalid_properties.push('invalid value for "short_code", the character length must be smaller than or equal to 30.')
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
if !@state.nil? && @state.to_s.length > 30
|
|
215
|
+
invalid_properties.push('invalid value for "state", the character length must be smaller than or equal to 30.')
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
invalid_properties
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Check to see if the all the properties in the model are valid
|
|
222
|
+
# @return true if the model is valid
|
|
223
|
+
def valid?
|
|
224
|
+
return false if !@city.nil? && @city.to_s.length > 50
|
|
225
|
+
return false if !@company_name.nil? && @company_name.to_s.length > 100
|
|
226
|
+
return false if !@country_code.nil? && @country_code.to_s.length > 2
|
|
227
|
+
return false if !@email.nil? && @email.to_s.length > 150
|
|
228
|
+
return false if !@first_name.nil? && @first_name.to_s.length > 50
|
|
229
|
+
return false if !@last_name.nil? && @last_name.to_s.length > 50
|
|
230
|
+
return false if !@postal_code.nil? && @postal_code.to_s.length > 15
|
|
231
|
+
return false if !@short_code.nil? && @short_code.to_s.length > 30
|
|
232
|
+
return false if !@state.nil? && @state.to_s.length > 30
|
|
233
|
+
status_validator = EnumAttributeValidator.new('String', ["Active", "Inactive"])
|
|
234
|
+
return false unless status_validator.valid?(@status)
|
|
235
|
+
true
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# Custom attribute writer method with validation
|
|
239
|
+
# @param [Object] city Value to be assigned
|
|
240
|
+
def city=(city)
|
|
241
|
+
if !city.nil? && city.to_s.length > 50
|
|
242
|
+
fail ArgumentError, 'invalid value for "city", the character length must be smaller than or equal to 50.'
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
@city = city
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
# Custom attribute writer method with validation
|
|
249
|
+
# @param [Object] company_name Value to be assigned
|
|
250
|
+
def company_name=(company_name)
|
|
251
|
+
if !company_name.nil? && company_name.to_s.length > 100
|
|
252
|
+
fail ArgumentError, 'invalid value for "company_name", the character length must be smaller than or equal to 100.'
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
@company_name = company_name
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
# Custom attribute writer method with validation
|
|
259
|
+
# @param [Object] country_code Value to be assigned
|
|
260
|
+
def country_code=(country_code)
|
|
261
|
+
if !country_code.nil? && country_code.to_s.length > 2
|
|
262
|
+
fail ArgumentError, 'invalid value for "country_code", the character length must be smaller than or equal to 2.'
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
@country_code = country_code
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
# Custom attribute writer method with validation
|
|
269
|
+
# @param [Object] email Value to be assigned
|
|
270
|
+
def email=(email)
|
|
271
|
+
if !email.nil? && email.to_s.length > 150
|
|
272
|
+
fail ArgumentError, 'invalid value for "email", the character length must be smaller than or equal to 150.'
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
@email = email
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
# Custom attribute writer method with validation
|
|
279
|
+
# @param [Object] first_name Value to be assigned
|
|
280
|
+
def first_name=(first_name)
|
|
281
|
+
if !first_name.nil? && first_name.to_s.length > 50
|
|
282
|
+
fail ArgumentError, 'invalid value for "first_name", the character length must be smaller than or equal to 50.'
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
@first_name = first_name
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
# Custom attribute writer method with validation
|
|
289
|
+
# @param [Object] last_name Value to be assigned
|
|
290
|
+
def last_name=(last_name)
|
|
291
|
+
if !last_name.nil? && last_name.to_s.length > 50
|
|
292
|
+
fail ArgumentError, 'invalid value for "last_name", the character length must be smaller than or equal to 50.'
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
@last_name = last_name
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
# Custom attribute writer method with validation
|
|
299
|
+
# @param [Object] postal_code Value to be assigned
|
|
300
|
+
def postal_code=(postal_code)
|
|
301
|
+
if !postal_code.nil? && postal_code.to_s.length > 15
|
|
302
|
+
fail ArgumentError, 'invalid value for "postal_code", the character length must be smaller than or equal to 15.'
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
@postal_code = postal_code
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# Custom attribute writer method with validation
|
|
309
|
+
# @param [Object] short_code Value to be assigned
|
|
310
|
+
def short_code=(short_code)
|
|
311
|
+
if !short_code.nil? && short_code.to_s.length > 30
|
|
312
|
+
fail ArgumentError, 'invalid value for "short_code", the character length must be smaller than or equal to 30.'
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
@short_code = short_code
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
# Custom attribute writer method with validation
|
|
319
|
+
# @param [Object] state Value to be assigned
|
|
320
|
+
def state=(state)
|
|
321
|
+
if !state.nil? && state.to_s.length > 30
|
|
322
|
+
fail ArgumentError, 'invalid value for "state", the character length must be smaller than or equal to 30.'
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
@state = state
|
|
326
|
+
end
|
|
327
|
+
|
|
328
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
329
|
+
# @param [Object] status Object to be assigned
|
|
330
|
+
def status=(status)
|
|
331
|
+
validator = EnumAttributeValidator.new('String', ["Active", "Inactive"])
|
|
332
|
+
unless validator.valid?(status)
|
|
333
|
+
fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
|
|
334
|
+
end
|
|
335
|
+
@status = status
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
# Checks equality by comparing each attribute.
|
|
339
|
+
# @param [Object] Object to be compared
|
|
340
|
+
def ==(o)
|
|
341
|
+
return true if self.equal?(o)
|
|
342
|
+
self.class == o.class &&
|
|
343
|
+
affiliate_oid == o.affiliate_oid &&
|
|
344
|
+
city == o.city &&
|
|
345
|
+
company_name == o.company_name &&
|
|
346
|
+
country_code == o.country_code &&
|
|
347
|
+
email == o.email &&
|
|
348
|
+
first_name == o.first_name &&
|
|
349
|
+
last_name == o.last_name &&
|
|
350
|
+
postal_code == o.postal_code &&
|
|
351
|
+
short_code == o.short_code &&
|
|
352
|
+
state == o.state &&
|
|
353
|
+
status == o.status
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
# @see the `==` method
|
|
357
|
+
# @param [Object] Object to be compared
|
|
358
|
+
def eql?(o)
|
|
359
|
+
self == o
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
# Calculates hash code according to all attributes.
|
|
363
|
+
# @return [Integer] Hash code
|
|
364
|
+
def hash
|
|
365
|
+
[affiliate_oid, city, company_name, country_code, email, first_name, last_name, postal_code, short_code, state, status].hash
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
# Builds the object from hash
|
|
369
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
370
|
+
# @return [Object] Returns the model itself
|
|
371
|
+
def self.build_from_hash(attributes)
|
|
372
|
+
new.build_from_hash(attributes)
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
# Builds the object from hash
|
|
376
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
377
|
+
# @return [Object] Returns the model itself
|
|
378
|
+
def build_from_hash(attributes)
|
|
379
|
+
return nil unless attributes.is_a?(Hash)
|
|
380
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
381
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
382
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
383
|
+
self.send("#{key}=", nil)
|
|
384
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
385
|
+
# check to ensure the input is an array given that the attribute
|
|
386
|
+
# is documented as an array but the input is not
|
|
387
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
388
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
389
|
+
end
|
|
390
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
391
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
392
|
+
end
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
self
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
# Deserializes the data based on type
|
|
399
|
+
# @param string type Data type
|
|
400
|
+
# @param string value Value to be deserialized
|
|
401
|
+
# @return [Object] Deserialized data
|
|
402
|
+
def _deserialize(type, value)
|
|
403
|
+
case type.to_sym
|
|
404
|
+
when :Time
|
|
405
|
+
Time.parse(value)
|
|
406
|
+
when :Date
|
|
407
|
+
Date.parse(value)
|
|
408
|
+
when :String
|
|
409
|
+
value.to_s
|
|
410
|
+
when :Integer
|
|
411
|
+
value.to_i
|
|
412
|
+
when :Float
|
|
413
|
+
value.to_f
|
|
414
|
+
when :Boolean
|
|
415
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
416
|
+
true
|
|
417
|
+
else
|
|
418
|
+
false
|
|
419
|
+
end
|
|
420
|
+
when :Object
|
|
421
|
+
# generic object (usually a Hash), return directly
|
|
422
|
+
value
|
|
423
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
424
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
425
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
426
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
427
|
+
k_type = Regexp.last_match[:k_type]
|
|
428
|
+
v_type = Regexp.last_match[:v_type]
|
|
429
|
+
{}.tap do |hash|
|
|
430
|
+
value.each do |k, v|
|
|
431
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
432
|
+
end
|
|
433
|
+
end
|
|
434
|
+
else # model
|
|
435
|
+
# models (e.g. Pet) or oneOf
|
|
436
|
+
klass = UltracartClient.const_get(type)
|
|
437
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
438
|
+
end
|
|
439
|
+
end
|
|
440
|
+
|
|
441
|
+
# Returns the string representation of the object
|
|
442
|
+
# @return [String] String presentation of the object
|
|
443
|
+
def to_s
|
|
444
|
+
to_hash.to_s
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
448
|
+
# @return [Hash] Returns the object in the form of hash
|
|
449
|
+
def to_body
|
|
450
|
+
to_hash
|
|
451
|
+
end
|
|
452
|
+
|
|
453
|
+
# Returns the object in the form of hash
|
|
454
|
+
# @return [Hash] Returns the object in the form of hash
|
|
455
|
+
def to_hash
|
|
456
|
+
hash = {}
|
|
457
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
458
|
+
value = self.send(attr)
|
|
459
|
+
if value.nil?
|
|
460
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
461
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
462
|
+
end
|
|
463
|
+
|
|
464
|
+
hash[param] = _to_hash(value)
|
|
465
|
+
end
|
|
466
|
+
hash
|
|
467
|
+
end
|
|
468
|
+
|
|
469
|
+
# Outputs non-array value in the form of hash
|
|
470
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
471
|
+
# @param [Object] value Any valid value
|
|
472
|
+
# @return [Hash] Returns the value in the form of hash
|
|
473
|
+
def _to_hash(value)
|
|
474
|
+
if value.is_a?(Array)
|
|
475
|
+
value.compact.map { |v| _to_hash(v) }
|
|
476
|
+
elsif value.is_a?(Hash)
|
|
477
|
+
{}.tap do |hash|
|
|
478
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
479
|
+
end
|
|
480
|
+
elsif value.respond_to? :to_hash
|
|
481
|
+
value.to_hash
|
|
482
|
+
else
|
|
483
|
+
value
|
|
484
|
+
end
|
|
485
|
+
end
|
|
486
|
+
|
|
487
|
+
end
|
|
488
|
+
|
|
489
|
+
end
|