dear-inventory-ruby 0.2.13 → 0.2.14

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 (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +11 -4
  4. data/docs/Account.md +17 -19
  5. data/docs/Accounts.md +5 -7
  6. data/docs/Address.md +10 -12
  7. data/docs/AttachmentLine.md +7 -9
  8. data/docs/AttributeSet.md +79 -0
  9. data/docs/AttributeSetAttribute.md +19 -0
  10. data/docs/AttributeSets.md +19 -0
  11. data/docs/Bin.md +4 -6
  12. data/docs/Carrier.md +4 -6
  13. data/docs/Carriers.md +5 -7
  14. data/docs/Contact.md +13 -15
  15. data/docs/Customer.md +34 -36
  16. data/docs/Customers.md +5 -7
  17. data/docs/Error.md +4 -6
  18. data/docs/ExternalHeader.md +4 -6
  19. data/docs/InventoryApi.md +446 -274
  20. data/docs/Location.md +20 -22
  21. data/docs/Locations.md +5 -7
  22. data/docs/Me.md +9 -11
  23. data/docs/MeContact.md +11 -13
  24. data/docs/MeContacts.md +5 -7
  25. data/docs/PaymentTerm.md +8 -10
  26. data/docs/PaymentTerms.md +5 -7
  27. data/docs/PriceTier.md +4 -6
  28. data/docs/PriceTiers.md +3 -5
  29. data/docs/Sale.md +45 -47
  30. data/docs/SaleAdditionalCharge.md +10 -12
  31. data/docs/SaleInvoice.md +19 -21
  32. data/docs/SaleInvoiceAdditionalCharge.md +11 -13
  33. data/docs/SaleInvoiceDelete.md +4 -6
  34. data/docs/SaleInvoiceLine.md +14 -16
  35. data/docs/SaleInvoicePartial.md +15 -17
  36. data/docs/SaleInvoicePost.md +15 -17
  37. data/docs/SaleInvoices.md +4 -6
  38. data/docs/SaleItem.md +33 -35
  39. data/docs/SaleList.md +5 -7
  40. data/docs/SaleOrder.md +12 -14
  41. data/docs/SaleOrderLine.md +15 -17
  42. data/docs/SalePayment.md +16 -18
  43. data/docs/SalePaymentLine.md +9 -11
  44. data/docs/SaleQuote.md +11 -13
  45. data/docs/SaleQuoteLine.md +13 -15
  46. data/docs/ShippingAddress.md +13 -15
  47. data/docs/Success.md +3 -5
  48. data/docs/SupplierCustomerAddress.md +11 -13
  49. data/docs/Tax.md +11 -13
  50. data/docs/TaxComponent.md +6 -8
  51. data/docs/Taxes.md +5 -7
  52. data/docs/Webhook.md +12 -14
  53. data/docs/Webhooks.md +3 -5
  54. data/lib/dear-inventory-ruby/api/inventory_api.rb +253 -0
  55. data/lib/dear-inventory-ruby/models/attribute_set.rb +534 -0
  56. data/lib/dear-inventory-ruby/models/attribute_set_attribute.rb +237 -0
  57. data/lib/dear-inventory-ruby/models/attribute_sets.rb +229 -0
  58. data/lib/dear-inventory-ruby/version.rb +1 -1
  59. data/lib/dear-inventory-ruby.rb +3 -0
  60. data/spec/.DS_Store +0 -0
  61. data/spec/api/inventory_api_spec.rb +49 -0
  62. data/spec/models/attribute_set_attribute_spec.rb +53 -0
  63. data/spec/models/attribute_set_spec.rb +233 -0
  64. data/spec/models/attribute_sets_spec.rb +53 -0
  65. metadata +53 -41
@@ -0,0 +1,534 @@
1
+ =begin
2
+ #DEAR Inventory API
3
+
4
+ #This specifing endpoints for DEAR Inventory API
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: nnhansg@gmail.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DearInventoryRuby
16
+ class AttributeSet
17
+ # Unique Attribute Set identifier
18
+ attr_accessor :id
19
+
20
+ # Name of Attribute Set
21
+ attr_accessor :name
22
+
23
+ # Name of first attribute
24
+ attr_accessor :attribute1_name
25
+
26
+ # Type of first attribute. Should be one of the following values: `Text`, `List`, `Checkbox`, `Not used`, `Date`, `Numeric`
27
+ attr_accessor :attribute1_type
28
+
29
+ # Comma-separated list of values for first attribute (applicable when Type is List)
30
+ attr_accessor :attribute1_values
31
+
32
+ # Name of second attribute
33
+ attr_accessor :attribute2_name
34
+
35
+ # Type of second attribute. Should be one of the following values: `Text`, `List`, `Checkbox`, `Not used`, `Date`, `Numeric`
36
+ attr_accessor :attribute2_type
37
+
38
+ # Comma-separated list of values for second attribute (applicable when Type is List)
39
+ attr_accessor :attribute2_values
40
+
41
+ # Name of third attribute
42
+ attr_accessor :attribute3_name
43
+
44
+ # Type of third attribute. Should be one of the following values: `Text`, `List`, `Checkbox`, `Not used`, `Date`, `Numeric`
45
+ attr_accessor :attribute3_type
46
+
47
+ # Comma-separated list of values for third attribute (applicable when Type is List)
48
+ attr_accessor :attribute3_values
49
+
50
+ # Name of fourth attribute
51
+ attr_accessor :attribute4_name
52
+
53
+ # Type of fourth attribute. Should be one of the following values: `Text`, `List`, `Checkbox`, `Not used`, `Date`, `Numeric`
54
+ attr_accessor :attribute4_type
55
+
56
+ # Comma-separated list of values for fourth attribute (applicable when Type is List)
57
+ attr_accessor :attribute4_values
58
+
59
+ # Name of fifth attribute
60
+ attr_accessor :attribute5_name
61
+
62
+ # Type of fifth attribute. Should be one of the following values: `Text`, `List`, `Checkbox`, `Not used`, `Date`, `Numeric`
63
+ attr_accessor :attribute5_type
64
+
65
+ # Comma-separated list of values for fifth attribute (applicable when Type is List)
66
+ attr_accessor :attribute5_values
67
+
68
+ # Name of sixth attribute
69
+ attr_accessor :attribute6_name
70
+
71
+ # Type of sixth attribute. Should be one of the following values: `Text`, `List`, `Checkbox`, `Not used`, `Date`, `Numeric`
72
+ attr_accessor :attribute6_type
73
+
74
+ # Comma-separated list of values for sixth attribute (applicable when Type is List)
75
+ attr_accessor :attribute6_values
76
+
77
+ # Name of seventh attribute
78
+ attr_accessor :attribute7_name
79
+
80
+ # Type of seventh attribute. Should be one of the following values: `Text`, `List`, `Checkbox`, `Not used`, `Date`, `Numeric`
81
+ attr_accessor :attribute7_type
82
+
83
+ # Comma-separated list of values for seventh attribute (applicable when Type is List)
84
+ attr_accessor :attribute7_values
85
+
86
+ # Name of eighth attribute
87
+ attr_accessor :attribute8_name
88
+
89
+ # Type of eighth attribute. Should be one of the following values: `Text`, `List`, `Checkbox`, `Not used`, `Date`, `Numeric`
90
+ attr_accessor :attribute8_type
91
+
92
+ # Comma-separated list of values for eighth attribute (applicable when Type is List)
93
+ attr_accessor :attribute8_values
94
+
95
+ # Name of ninth attribute
96
+ attr_accessor :attribute9_name
97
+
98
+ # Type of ninth attribute. Should be one of the following values: `Text`, `List`, `Checkbox`, `Not used`, `Date`, `Numeric`
99
+ attr_accessor :attribute9_type
100
+
101
+ # Comma-separated list of values for ninth attribute (applicable when Type is List)
102
+ attr_accessor :attribute9_values
103
+
104
+ # Name of tenth attribute
105
+ attr_accessor :attribute10_name
106
+
107
+ # Type of tenth attribute. Should be one of the following values: `Text`, `List`, `Checkbox`, `Not used`, `Date`, `Numeric`
108
+ attr_accessor :attribute10_type
109
+
110
+ # Comma-separated list of values for tenth attribute (applicable when Type is List)
111
+ attr_accessor :attribute10_values
112
+
113
+ # Array of Attribute Set Attributes
114
+ attr_accessor :attributes
115
+
116
+ # Attribute mapping from ruby-style variable name to JSON key.
117
+ def self.attribute_map
118
+ {
119
+ :'id' => :'ID',
120
+ :'name' => :'Name',
121
+ :'attribute1_name' => :'Attribute1Name',
122
+ :'attribute1_type' => :'Attribute1Type',
123
+ :'attribute1_values' => :'Attribute1Values',
124
+ :'attribute2_name' => :'Attribute2Name',
125
+ :'attribute2_type' => :'Attribute2Type',
126
+ :'attribute2_values' => :'Attribute2Values',
127
+ :'attribute3_name' => :'Attribute3Name',
128
+ :'attribute3_type' => :'Attribute3Type',
129
+ :'attribute3_values' => :'Attribute3Values',
130
+ :'attribute4_name' => :'Attribute4Name',
131
+ :'attribute4_type' => :'Attribute4Type',
132
+ :'attribute4_values' => :'Attribute4Values',
133
+ :'attribute5_name' => :'Attribute5Name',
134
+ :'attribute5_type' => :'Attribute5Type',
135
+ :'attribute5_values' => :'Attribute5Values',
136
+ :'attribute6_name' => :'Attribute6Name',
137
+ :'attribute6_type' => :'Attribute6Type',
138
+ :'attribute6_values' => :'Attribute6Values',
139
+ :'attribute7_name' => :'Attribute7Name',
140
+ :'attribute7_type' => :'Attribute7Type',
141
+ :'attribute7_values' => :'Attribute7Values',
142
+ :'attribute8_name' => :'Attribute8Name',
143
+ :'attribute8_type' => :'Attribute8Type',
144
+ :'attribute8_values' => :'Attribute8Values',
145
+ :'attribute9_name' => :'Attribute9Name',
146
+ :'attribute9_type' => :'Attribute9Type',
147
+ :'attribute9_values' => :'Attribute9Values',
148
+ :'attribute10_name' => :'Attribute10Name',
149
+ :'attribute10_type' => :'Attribute10Type',
150
+ :'attribute10_values' => :'Attribute10Values',
151
+ :'attributes' => :'Attributes'
152
+ }
153
+ end
154
+
155
+ # Attribute type mapping.
156
+ def self.openapi_types
157
+ {
158
+ :'id' => :'String',
159
+ :'name' => :'String',
160
+ :'attribute1_name' => :'String',
161
+ :'attribute1_type' => :'String',
162
+ :'attribute1_values' => :'String',
163
+ :'attribute2_name' => :'String',
164
+ :'attribute2_type' => :'String',
165
+ :'attribute2_values' => :'String',
166
+ :'attribute3_name' => :'String',
167
+ :'attribute3_type' => :'String',
168
+ :'attribute3_values' => :'String',
169
+ :'attribute4_name' => :'String',
170
+ :'attribute4_type' => :'String',
171
+ :'attribute4_values' => :'String',
172
+ :'attribute5_name' => :'String',
173
+ :'attribute5_type' => :'String',
174
+ :'attribute5_values' => :'String',
175
+ :'attribute6_name' => :'String',
176
+ :'attribute6_type' => :'String',
177
+ :'attribute6_values' => :'String',
178
+ :'attribute7_name' => :'String',
179
+ :'attribute7_type' => :'String',
180
+ :'attribute7_values' => :'String',
181
+ :'attribute8_name' => :'String',
182
+ :'attribute8_type' => :'String',
183
+ :'attribute8_values' => :'String',
184
+ :'attribute9_name' => :'String',
185
+ :'attribute9_type' => :'String',
186
+ :'attribute9_values' => :'String',
187
+ :'attribute10_name' => :'String',
188
+ :'attribute10_type' => :'String',
189
+ :'attribute10_values' => :'String',
190
+ :'attributes' => :'Array<AttributeSetAttribute>'
191
+ }
192
+ end
193
+
194
+ # List of attributes with nullable: true
195
+ def self.openapi_nullable
196
+ Set.new([
197
+ ])
198
+ end
199
+
200
+ # Initializes the object
201
+ # @param [Hash] attributes Model attributes in the form of hash
202
+ def initialize(attributes = {})
203
+ if (!attributes.is_a?(Hash))
204
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DearInventoryRuby::AttributeSet` initialize method"
205
+ end
206
+
207
+ # check to see if the attribute exists and convert string to symbol for hash key
208
+ attributes = attributes.each_with_object({}) { |(k, v), h|
209
+ if (!self.class.attribute_map.key?(k.to_sym))
210
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DearInventoryRuby::AttributeSet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
211
+ end
212
+ h[k.to_sym] = v
213
+ }
214
+
215
+ if attributes.key?(:'id')
216
+ self.id = attributes[:'id']
217
+ end
218
+
219
+ if attributes.key?(:'name')
220
+ self.name = attributes[:'name']
221
+ end
222
+
223
+ if attributes.key?(:'attribute1_name')
224
+ self.attribute1_name = attributes[:'attribute1_name']
225
+ end
226
+
227
+ if attributes.key?(:'attribute1_type')
228
+ self.attribute1_type = attributes[:'attribute1_type']
229
+ end
230
+
231
+ if attributes.key?(:'attribute1_values')
232
+ self.attribute1_values = attributes[:'attribute1_values']
233
+ end
234
+
235
+ if attributes.key?(:'attribute2_name')
236
+ self.attribute2_name = attributes[:'attribute2_name']
237
+ end
238
+
239
+ if attributes.key?(:'attribute2_type')
240
+ self.attribute2_type = attributes[:'attribute2_type']
241
+ end
242
+
243
+ if attributes.key?(:'attribute2_values')
244
+ self.attribute2_values = attributes[:'attribute2_values']
245
+ end
246
+
247
+ if attributes.key?(:'attribute3_name')
248
+ self.attribute3_name = attributes[:'attribute3_name']
249
+ end
250
+
251
+ if attributes.key?(:'attribute3_type')
252
+ self.attribute3_type = attributes[:'attribute3_type']
253
+ end
254
+
255
+ if attributes.key?(:'attribute3_values')
256
+ self.attribute3_values = attributes[:'attribute3_values']
257
+ end
258
+
259
+ if attributes.key?(:'attribute4_name')
260
+ self.attribute4_name = attributes[:'attribute4_name']
261
+ end
262
+
263
+ if attributes.key?(:'attribute4_type')
264
+ self.attribute4_type = attributes[:'attribute4_type']
265
+ end
266
+
267
+ if attributes.key?(:'attribute4_values')
268
+ self.attribute4_values = attributes[:'attribute4_values']
269
+ end
270
+
271
+ if attributes.key?(:'attribute5_name')
272
+ self.attribute5_name = attributes[:'attribute5_name']
273
+ end
274
+
275
+ if attributes.key?(:'attribute5_type')
276
+ self.attribute5_type = attributes[:'attribute5_type']
277
+ end
278
+
279
+ if attributes.key?(:'attribute5_values')
280
+ self.attribute5_values = attributes[:'attribute5_values']
281
+ end
282
+
283
+ if attributes.key?(:'attribute6_name')
284
+ self.attribute6_name = attributes[:'attribute6_name']
285
+ end
286
+
287
+ if attributes.key?(:'attribute6_type')
288
+ self.attribute6_type = attributes[:'attribute6_type']
289
+ end
290
+
291
+ if attributes.key?(:'attribute6_values')
292
+ self.attribute6_values = attributes[:'attribute6_values']
293
+ end
294
+
295
+ if attributes.key?(:'attribute7_name')
296
+ self.attribute7_name = attributes[:'attribute7_name']
297
+ end
298
+
299
+ if attributes.key?(:'attribute7_type')
300
+ self.attribute7_type = attributes[:'attribute7_type']
301
+ end
302
+
303
+ if attributes.key?(:'attribute7_values')
304
+ self.attribute7_values = attributes[:'attribute7_values']
305
+ end
306
+
307
+ if attributes.key?(:'attribute8_name')
308
+ self.attribute8_name = attributes[:'attribute8_name']
309
+ end
310
+
311
+ if attributes.key?(:'attribute8_type')
312
+ self.attribute8_type = attributes[:'attribute8_type']
313
+ end
314
+
315
+ if attributes.key?(:'attribute8_values')
316
+ self.attribute8_values = attributes[:'attribute8_values']
317
+ end
318
+
319
+ if attributes.key?(:'attribute9_name')
320
+ self.attribute9_name = attributes[:'attribute9_name']
321
+ end
322
+
323
+ if attributes.key?(:'attribute9_type')
324
+ self.attribute9_type = attributes[:'attribute9_type']
325
+ end
326
+
327
+ if attributes.key?(:'attribute9_values')
328
+ self.attribute9_values = attributes[:'attribute9_values']
329
+ end
330
+
331
+ if attributes.key?(:'attribute10_name')
332
+ self.attribute10_name = attributes[:'attribute10_name']
333
+ end
334
+
335
+ if attributes.key?(:'attribute10_type')
336
+ self.attribute10_type = attributes[:'attribute10_type']
337
+ end
338
+
339
+ if attributes.key?(:'attribute10_values')
340
+ self.attribute10_values = attributes[:'attribute10_values']
341
+ end
342
+
343
+ if attributes.key?(:'attributes')
344
+ if (value = attributes[:'attributes']).is_a?(Array)
345
+ self.attributes = value
346
+ end
347
+ end
348
+ end
349
+
350
+ # Show invalid properties with the reasons. Usually used together with valid?
351
+ # @return Array for valid properties with the reasons
352
+ def list_invalid_properties
353
+ invalid_properties = Array.new
354
+ if @name.nil?
355
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
356
+ end
357
+
358
+ invalid_properties
359
+ end
360
+
361
+ # Check to see if the all the properties in the model are valid
362
+ # @return true if the model is valid
363
+ def valid?
364
+ return false if @name.nil?
365
+ true
366
+ end
367
+
368
+ # Checks equality by comparing each attribute.
369
+ # @param [Object] Object to be compared
370
+ def ==(o)
371
+ return true if self.equal?(o)
372
+ self.class == o.class &&
373
+ id == o.id &&
374
+ name == o.name &&
375
+ attribute1_name == o.attribute1_name &&
376
+ attribute1_type == o.attribute1_type &&
377
+ attribute1_values == o.attribute1_values &&
378
+ attribute2_name == o.attribute2_name &&
379
+ attribute2_type == o.attribute2_type &&
380
+ attribute2_values == o.attribute2_values &&
381
+ attribute3_name == o.attribute3_name &&
382
+ attribute3_type == o.attribute3_type &&
383
+ attribute3_values == o.attribute3_values &&
384
+ attribute4_name == o.attribute4_name &&
385
+ attribute4_type == o.attribute4_type &&
386
+ attribute4_values == o.attribute4_values &&
387
+ attribute5_name == o.attribute5_name &&
388
+ attribute5_type == o.attribute5_type &&
389
+ attribute5_values == o.attribute5_values &&
390
+ attribute6_name == o.attribute6_name &&
391
+ attribute6_type == o.attribute6_type &&
392
+ attribute6_values == o.attribute6_values &&
393
+ attribute7_name == o.attribute7_name &&
394
+ attribute7_type == o.attribute7_type &&
395
+ attribute7_values == o.attribute7_values &&
396
+ attribute8_name == o.attribute8_name &&
397
+ attribute8_type == o.attribute8_type &&
398
+ attribute8_values == o.attribute8_values &&
399
+ attribute9_name == o.attribute9_name &&
400
+ attribute9_type == o.attribute9_type &&
401
+ attribute9_values == o.attribute9_values &&
402
+ attribute10_name == o.attribute10_name &&
403
+ attribute10_type == o.attribute10_type &&
404
+ attribute10_values == o.attribute10_values &&
405
+ attributes == o.attributes
406
+ end
407
+
408
+ # @see the `==` method
409
+ # @param [Object] Object to be compared
410
+ def eql?(o)
411
+ self == o
412
+ end
413
+
414
+ # Calculates hash code according to all attributes.
415
+ # @return [Integer] Hash code
416
+ def hash
417
+ [id, name, attribute1_name, attribute1_type, attribute1_values, attribute2_name, attribute2_type, attribute2_values, attribute3_name, attribute3_type, attribute3_values, attribute4_name, attribute4_type, attribute4_values, attribute5_name, attribute5_type, attribute5_values, attribute6_name, attribute6_type, attribute6_values, attribute7_name, attribute7_type, attribute7_values, attribute8_name, attribute8_type, attribute8_values, attribute9_name, attribute9_type, attribute9_values, attribute10_name, attribute10_type, attribute10_values, attributes].hash
418
+ end
419
+
420
+ # Builds the object from hash
421
+ # @param [Hash] attributes Model attributes in the form of hash
422
+ # @return [Object] Returns the model itself
423
+ def self.build_from_hash(attributes)
424
+ new.build_from_hash(attributes)
425
+ end
426
+
427
+ # Builds the object from hash
428
+ # @param [Hash] attributes Model attributes in the form of hash
429
+ # @return [Object] Returns the model itself
430
+ def build_from_hash(attributes)
431
+ return nil unless attributes.is_a?(Hash)
432
+ self.class.openapi_types.each_pair do |key, type|
433
+ if type =~ /\AArray<(.*)>/i
434
+ # check to ensure the input is an array given that the attribute
435
+ # is documented as an array but the input is not
436
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
437
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
438
+ end
439
+ elsif !attributes[self.class.attribute_map[key]].nil?
440
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
441
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
442
+ end
443
+
444
+ self
445
+ end
446
+
447
+ # Deserializes the data based on type
448
+ # @param string type Data type
449
+ # @param string value Value to be deserialized
450
+ # @return [Object] Deserialized data
451
+ def _deserialize(type, value)
452
+ case type.to_sym
453
+ when :DateTime
454
+ DateTime.parse(value)
455
+ when :Date
456
+ Date.parse(value)
457
+ when :String
458
+ value.to_s
459
+ when :Integer
460
+ value.to_i
461
+ when :Float
462
+ value.to_f
463
+ when :Boolean
464
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
465
+ true
466
+ else
467
+ false
468
+ end
469
+ when :Object
470
+ # generic object (usually a Hash), return directly
471
+ value
472
+ when /\AArray<(?<inner_type>.+)>\z/
473
+ inner_type = Regexp.last_match[:inner_type]
474
+ value.map { |v| _deserialize(inner_type, v) }
475
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
476
+ k_type = Regexp.last_match[:k_type]
477
+ v_type = Regexp.last_match[:v_type]
478
+ {}.tap do |hash|
479
+ value.each do |k, v|
480
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
481
+ end
482
+ end
483
+ else # model
484
+ DearInventoryRuby.const_get(type).build_from_hash(value)
485
+ end
486
+ end
487
+
488
+ # Returns the string representation of the object
489
+ # @return [String] String presentation of the object
490
+ def to_s
491
+ to_hash.to_s
492
+ end
493
+
494
+ # to_body is an alias to to_hash (backward compatibility)
495
+ # @return [Hash] Returns the object in the form of hash
496
+ def to_body
497
+ to_hash
498
+ end
499
+
500
+ # Returns the object in the form of hash
501
+ # @return [Hash] Returns the object in the form of hash
502
+ def to_hash
503
+ hash = {}
504
+ self.class.attribute_map.each_pair do |attr, param|
505
+ value = self.send(attr)
506
+ if value.nil?
507
+ is_nullable = self.class.openapi_nullable.include?(attr)
508
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
509
+ end
510
+
511
+ hash[param] = _to_hash(value)
512
+ end
513
+ hash
514
+ end
515
+
516
+ # Outputs non-array value in the form of hash
517
+ # For object, use to_hash. Otherwise, just return the value
518
+ # @param [Object] value Any valid value
519
+ # @return [Hash] Returns the value in the form of hash
520
+ def _to_hash(value)
521
+ if value.is_a?(Array)
522
+ value.compact.map { |v| _to_hash(v) }
523
+ elsif value.is_a?(Hash)
524
+ {}.tap do |hash|
525
+ value.each { |k, v| hash[k] = _to_hash(v) }
526
+ end
527
+ elsif value.respond_to? :to_hash
528
+ value.to_hash
529
+ else
530
+ value
531
+ end
532
+ end
533
+ end
534
+ end