dear-inventory-ruby 0.1.16 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -10
  3. data/README.md +32 -7
  4. data/dear-inventory-ruby.gemspec +1 -1
  5. data/docs/Address.md +10 -12
  6. data/docs/Customer.md +1 -1
  7. data/docs/ExternalHeader.md +19 -0
  8. data/docs/InventoryApi.md +1021 -161
  9. data/docs/Me.md +1 -1
  10. data/docs/SaleAdditionalCharge.md +31 -0
  11. data/docs/SaleInvoice.md +1 -1
  12. data/docs/SaleInvoiceAdditionalCharge.md +3 -3
  13. data/docs/SaleInvoiceDelete.md +19 -0
  14. data/docs/SaleInvoiceLine.md +2 -2
  15. data/docs/SaleInvoicePost.md +41 -0
  16. data/docs/SaleOrder.md +35 -0
  17. data/docs/SaleOrderLine.md +41 -0
  18. data/docs/SalePayment.md +43 -0
  19. data/docs/SaleQuote.md +33 -0
  20. data/docs/SaleQuoteLine.md +37 -0
  21. data/docs/ShippingAddress.md +37 -0
  22. data/docs/SupplierCustomerAddress.md +33 -0
  23. data/docs/Webhook.md +35 -0
  24. data/docs/Webhooks.md +17 -0
  25. data/lib/dear-inventory-ruby/api/inventory_api.rb +988 -119
  26. data/lib/dear-inventory-ruby/models/account.rb +0 -34
  27. data/lib/dear-inventory-ruby/models/address.rb +28 -115
  28. data/lib/dear-inventory-ruby/models/customer.rb +1 -35
  29. data/lib/dear-inventory-ruby/models/external_header.rb +217 -0
  30. data/lib/dear-inventory-ruby/models/me.rb +2 -1
  31. data/lib/dear-inventory-ruby/models/payment_term.rb +0 -34
  32. data/lib/dear-inventory-ruby/models/sale_additional_charge.rb +302 -0
  33. data/lib/dear-inventory-ruby/models/sale_invoice.rb +1 -1
  34. data/lib/dear-inventory-ruby/models/sale_invoice_additional_charge.rb +3 -3
  35. data/lib/dear-inventory-ruby/models/sale_invoice_delete.rb +224 -0
  36. data/lib/dear-inventory-ruby/models/sale_invoice_line.rb +0 -10
  37. data/lib/dear-inventory-ruby/models/sale_invoice_post.rb +361 -0
  38. data/lib/dear-inventory-ruby/models/sale_order.rb +336 -0
  39. data/lib/dear-inventory-ruby/models/sale_order_line.rb +342 -0
  40. data/lib/dear-inventory-ruby/models/sale_payment.rb +337 -0
  41. data/lib/dear-inventory-ruby/models/sale_quote.rb +326 -0
  42. data/lib/dear-inventory-ruby/models/sale_quote_line.rb +322 -0
  43. data/lib/dear-inventory-ruby/models/shipping_address.rb +317 -0
  44. data/lib/dear-inventory-ruby/models/supplier_customer_address.rb +374 -0
  45. data/lib/dear-inventory-ruby/models/webhook.rb +319 -0
  46. data/lib/dear-inventory-ruby/models/webhooks.rb +209 -0
  47. data/lib/dear-inventory-ruby/version.rb +1 -1
  48. data/lib/dear-inventory-ruby.rb +13 -2
  49. data/spec/api/inventory_api_spec.rb +166 -0
  50. data/spec/models/account_spec.rb +0 -4
  51. data/spec/models/address_spec.rb +7 -13
  52. data/spec/models/customer_spec.rb +0 -4
  53. data/spec/models/external_header_spec.rb +47 -0
  54. data/spec/models/payment_term_spec.rb +0 -4
  55. data/spec/models/sale_additional_charge_spec.rb +83 -0
  56. data/spec/models/sale_invoice_delete_spec.rb +47 -0
  57. data/spec/models/sale_invoice_post_spec.rb +113 -0
  58. data/spec/models/sale_order_line_spec.rb +113 -0
  59. data/spec/models/sale_order_spec.rb +95 -0
  60. data/spec/models/sale_payment_spec.rb +119 -0
  61. data/spec/models/sale_quote_line_spec.rb +101 -0
  62. data/spec/models/sale_quote_spec.rb +89 -0
  63. data/spec/models/shipping_address_spec.rb +101 -0
  64. data/spec/models/supplier_customer_address_spec.rb +89 -0
  65. data/spec/models/webhook_spec.rb +95 -0
  66. data/spec/models/{currency_code_spec.rb → webhooks_spec.rb} +12 -6
  67. metadata +63 -14
  68. data/docs/CurrencyCode.md +0 -16
  69. data/docs/DimensionsUnit.md +0 -16
  70. data/lib/dear-inventory-ruby/models/currency_code.rb +0 -196
  71. data/lib/dear-inventory-ruby/models/dimensions_unit.rb +0 -42
  72. data/spec/.DS_Store +0 -0
  73. data/spec/models/dimensions_unit_spec.rb +0 -35
@@ -59,28 +59,6 @@ module DearInventoryRuby
59
59
  # Currency. Read-only.
60
60
  attr_accessor :currency
61
61
 
62
- class EnumAttributeValidator
63
- attr_reader :datatype
64
- attr_reader :allowable_values
65
-
66
- def initialize(datatype, allowable_values)
67
- @allowable_values = allowable_values.map do |value|
68
- case datatype.to_s
69
- when /Integer/i
70
- value.to_i
71
- when /Float/i
72
- value.to_f
73
- else
74
- value
75
- end
76
- end
77
- end
78
-
79
- def valid?(value)
80
- !value || allowable_values.include?(value)
81
- end
82
- end
83
-
84
62
  # Attribute mapping from ruby-style variable name to JSON key.
85
63
  def self.attribute_map
86
64
  {
@@ -255,8 +233,6 @@ module DearInventoryRuby
255
233
  return false if @type.to_s.length > 50
256
234
  return false if @status.nil?
257
235
  return false if @status.to_s.length > 50
258
- _class_validator = EnumAttributeValidator.new('String', ["ASSET", "LIABILITY", "EXPENSE", "EQUITY", "REVENUE"])
259
- return false unless _class_validator.valid?(@_class)
260
236
  true
261
237
  end
262
238
 
@@ -316,16 +292,6 @@ module DearInventoryRuby
316
292
  @status = status
317
293
  end
318
294
 
319
- # Custom attribute writer method checking allowed values (enum).
320
- # @param [Object] _class Object to be assigned
321
- def _class=(_class)
322
- validator = EnumAttributeValidator.new('String', ["ASSET", "LIABILITY", "EXPENSE", "EQUITY", "REVENUE"])
323
- unless validator.valid?(_class)
324
- fail ArgumentError, "invalid value for \"_class\", must be one of #{validator.allowable_values}."
325
- end
326
- @_class = _class
327
- end
328
-
329
295
  # Checks equality by comparing each attribute.
330
296
  # @param [Object] Object to be compared
331
297
  def ==(o)
@@ -14,8 +14,11 @@ require 'date'
14
14
 
15
15
  module DearInventoryRuby
16
16
  class Address
17
- # If passed in PUT method, entry will be searched by id, found entry will be updated, otherwise created
18
- attr_accessor :id
17
+ # Address Line 1 as displayed on Sale form. = Line1 + Line2
18
+ attr_accessor :display_address_line1
19
+
20
+ # Address Line 2 as displayed on Sale form. = City + State/Region + Zip/Postcode + Country
21
+ attr_accessor :display_address_line2
19
22
 
20
23
  # Address Line 1
21
24
  attr_accessor :line1
@@ -23,51 +26,43 @@ module DearInventoryRuby
23
26
  # Address Line 2
24
27
  attr_accessor :line2
25
28
 
26
- # City / Suburb
29
+ # City
27
30
  attr_accessor :city
28
31
 
29
- # State / Province
32
+ # State
30
33
  attr_accessor :state
31
34
 
32
- # Zip / PostCode
35
+ # PostCode
33
36
  attr_accessor :post_code
34
37
 
35
- # Country name
38
+ # Country
36
39
  attr_accessor :country
37
40
 
38
- # Address Type. Should be one of the following values: `Billing`, `Business` or `Shipping`.
39
- attr_accessor :type
40
-
41
- # Points that Address is used as default for chosen Type. `false` as default.
42
- attr_accessor :default_for_type
43
-
44
41
  # Attribute mapping from ruby-style variable name to JSON key.
45
42
  def self.attribute_map
46
43
  {
47
- :'id' => :'ID',
44
+ :'display_address_line1' => :'DisplayAddressLine1',
45
+ :'display_address_line2' => :'DisplayAddressLine2',
48
46
  :'line1' => :'Line1',
49
47
  :'line2' => :'Line2',
50
48
  :'city' => :'City',
51
49
  :'state' => :'State',
52
50
  :'post_code' => :'PostCode',
53
- :'country' => :'Country',
54
- :'type' => :'Type',
55
- :'default_for_type' => :'DefaultForType'
51
+ :'country' => :'Country'
56
52
  }
57
53
  end
58
54
 
59
55
  # Attribute type mapping.
60
56
  def self.openapi_types
61
57
  {
62
- :'id' => :'String',
58
+ :'display_address_line1' => :'String',
59
+ :'display_address_line2' => :'String',
63
60
  :'line1' => :'String',
64
61
  :'line2' => :'String',
65
62
  :'city' => :'String',
66
63
  :'state' => :'String',
67
64
  :'post_code' => :'String',
68
- :'country' => :'String',
69
- :'type' => :'String',
70
- :'default_for_type' => :'Boolean'
65
+ :'country' => :'String'
71
66
  }
72
67
  end
73
68
 
@@ -92,8 +87,12 @@ module DearInventoryRuby
92
87
  h[k.to_sym] = v
93
88
  }
94
89
 
95
- if attributes.key?(:'id')
96
- self.id = attributes[:'id']
90
+ if attributes.key?(:'display_address_line1')
91
+ self.display_address_line1 = attributes[:'display_address_line1']
92
+ end
93
+
94
+ if attributes.key?(:'display_address_line2')
95
+ self.display_address_line2 = attributes[:'display_address_line2']
97
96
  end
98
97
 
99
98
  if attributes.key?(:'line1')
@@ -119,130 +118,44 @@ module DearInventoryRuby
119
118
  if attributes.key?(:'country')
120
119
  self.country = attributes[:'country']
121
120
  end
122
-
123
- if attributes.key?(:'type')
124
- self.type = attributes[:'type']
125
- end
126
-
127
- if attributes.key?(:'default_for_type')
128
- self.default_for_type = attributes[:'default_for_type']
129
- else
130
- self.default_for_type = false
131
- end
132
121
  end
133
122
 
134
123
  # Show invalid properties with the reasons. Usually used together with valid?
135
124
  # @return Array for valid properties with the reasons
136
125
  def list_invalid_properties
137
126
  invalid_properties = Array.new
138
- if !@line1.nil? && @line1.to_s.length > 256
139
- invalid_properties.push('invalid value for "line1", the character length must be smaller than or equal to 256.')
140
- end
141
-
142
- if !@line2.nil? && @line2.to_s.length > 256
143
- invalid_properties.push('invalid value for "line2", the character length must be smaller than or equal to 256.')
144
- end
145
-
146
- if !@city.nil? && @city.to_s.length > 256
147
- invalid_properties.push('invalid value for "city", the character length must be smaller than or equal to 256.')
148
- end
149
-
150
- if !@state.nil? && @state.to_s.length > 256
151
- invalid_properties.push('invalid value for "state", the character length must be smaller than or equal to 256.')
152
- end
153
-
154
- if !@post_code.nil? && @post_code.to_s.length > 20
155
- invalid_properties.push('invalid value for "post_code", the character length must be smaller than or equal to 20.')
127
+ if @line1.nil?
128
+ invalid_properties.push('invalid value for "line1", line1 cannot be nil.')
156
129
  end
157
130
 
158
131
  if @country.nil?
159
132
  invalid_properties.push('invalid value for "country", country cannot be nil.')
160
133
  end
161
134
 
162
- if @type.nil?
163
- invalid_properties.push('invalid value for "type", type cannot be nil.')
164
- end
165
-
166
135
  invalid_properties
167
136
  end
168
137
 
169
138
  # Check to see if the all the properties in the model are valid
170
139
  # @return true if the model is valid
171
140
  def valid?
172
- return false if !@line1.nil? && @line1.to_s.length > 256
173
- return false if !@line2.nil? && @line2.to_s.length > 256
174
- return false if !@city.nil? && @city.to_s.length > 256
175
- return false if !@state.nil? && @state.to_s.length > 256
176
- return false if !@post_code.nil? && @post_code.to_s.length > 20
141
+ return false if @line1.nil?
177
142
  return false if @country.nil?
178
- return false if @type.nil?
179
143
  true
180
144
  end
181
145
 
182
- # Custom attribute writer method with validation
183
- # @param [Object] line1 Value to be assigned
184
- def line1=(line1)
185
- if !line1.nil? && line1.to_s.length > 256
186
- fail ArgumentError, 'invalid value for "line1", the character length must be smaller than or equal to 256.'
187
- end
188
-
189
- @line1 = line1
190
- end
191
-
192
- # Custom attribute writer method with validation
193
- # @param [Object] line2 Value to be assigned
194
- def line2=(line2)
195
- if !line2.nil? && line2.to_s.length > 256
196
- fail ArgumentError, 'invalid value for "line2", the character length must be smaller than or equal to 256.'
197
- end
198
-
199
- @line2 = line2
200
- end
201
-
202
- # Custom attribute writer method with validation
203
- # @param [Object] city Value to be assigned
204
- def city=(city)
205
- if !city.nil? && city.to_s.length > 256
206
- fail ArgumentError, 'invalid value for "city", the character length must be smaller than or equal to 256.'
207
- end
208
-
209
- @city = city
210
- end
211
-
212
- # Custom attribute writer method with validation
213
- # @param [Object] state Value to be assigned
214
- def state=(state)
215
- if !state.nil? && state.to_s.length > 256
216
- fail ArgumentError, 'invalid value for "state", the character length must be smaller than or equal to 256.'
217
- end
218
-
219
- @state = state
220
- end
221
-
222
- # Custom attribute writer method with validation
223
- # @param [Object] post_code Value to be assigned
224
- def post_code=(post_code)
225
- if !post_code.nil? && post_code.to_s.length > 20
226
- fail ArgumentError, 'invalid value for "post_code", the character length must be smaller than or equal to 20.'
227
- end
228
-
229
- @post_code = post_code
230
- end
231
-
232
146
  # Checks equality by comparing each attribute.
233
147
  # @param [Object] Object to be compared
234
148
  def ==(o)
235
149
  return true if self.equal?(o)
236
150
  self.class == o.class &&
237
- id == o.id &&
151
+ display_address_line1 == o.display_address_line1 &&
152
+ display_address_line2 == o.display_address_line2 &&
238
153
  line1 == o.line1 &&
239
154
  line2 == o.line2 &&
240
155
  city == o.city &&
241
156
  state == o.state &&
242
157
  post_code == o.post_code &&
243
- country == o.country &&
244
- type == o.type &&
245
- default_for_type == o.default_for_type
158
+ country == o.country
246
159
  end
247
160
 
248
161
  # @see the `==` method
@@ -254,7 +167,7 @@ module DearInventoryRuby
254
167
  # Calculates hash code according to all attributes.
255
168
  # @return [Integer] Hash code
256
169
  def hash
257
- [id, line1, line2, city, state, post_code, country, type, default_for_type].hash
170
+ [display_address_line1, display_address_line2, line1, line2, city, state, post_code, country].hash
258
171
  end
259
172
 
260
173
  # Builds the object from hash
@@ -110,28 +110,6 @@ module DearInventoryRuby
110
110
  # List of contacts
111
111
  attr_accessor :contacts
112
112
 
113
- class EnumAttributeValidator
114
- attr_reader :datatype
115
- attr_reader :allowable_values
116
-
117
- def initialize(datatype, allowable_values)
118
- @allowable_values = allowable_values.map do |value|
119
- case datatype.to_s
120
- when /Integer/i
121
- value.to_i
122
- when /Float/i
123
- value.to_f
124
- else
125
- value
126
- end
127
- end
128
- end
129
-
130
- def valid?(value)
131
- !value || allowable_values.include?(value)
132
- end
133
- end
134
-
135
113
  # Attribute mapping from ruby-style variable name to JSON key.
136
114
  def self.attribute_map
137
115
  {
@@ -203,7 +181,7 @@ module DearInventoryRuby
203
181
  :'additional_attribute9' => :'String',
204
182
  :'additional_attribute10' => :'String',
205
183
  :'last_modified_on' => :'String',
206
- :'addresses' => :'Array<Address>',
184
+ :'addresses' => :'Array<SupplierCustomerAddress>',
207
185
  :'contacts' => :'Array<Contact>'
208
186
  }
209
187
  end
@@ -413,8 +391,6 @@ module DearInventoryRuby
413
391
  return false if @name.nil?
414
392
  return false if @name.to_s.length > 256
415
393
  return false if @status.nil?
416
- status_validator = EnumAttributeValidator.new('String', ["Active", "Deprecated"])
417
- return false unless status_validator.valid?(@status)
418
394
  return false if @currency.nil?
419
395
  return false if @payment_term.nil?
420
396
  return false if @account_receivable.nil?
@@ -438,16 +414,6 @@ module DearInventoryRuby
438
414
  @name = name
439
415
  end
440
416
 
441
- # Custom attribute writer method checking allowed values (enum).
442
- # @param [Object] status Object to be assigned
443
- def status=(status)
444
- validator = EnumAttributeValidator.new('String', ["Active", "Deprecated"])
445
- unless validator.valid?(status)
446
- fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
447
- end
448
- @status = status
449
- end
450
-
451
417
  # Custom attribute writer method with validation
452
418
  # @param [Object] comments Value to be assigned
453
419
  def comments=(comments)
@@ -0,0 +1,217 @@
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 ExternalHeader
17
+ # Key
18
+ attr_accessor :key
19
+
20
+ # Value
21
+ attr_accessor :value
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'key' => :'Key',
27
+ :'value' => :'Value'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'key' => :'String',
35
+ :'value' => :'String'
36
+ }
37
+ end
38
+
39
+ # List of attributes with nullable: true
40
+ def self.openapi_nullable
41
+ Set.new([
42
+ ])
43
+ end
44
+
45
+ # Initializes the object
46
+ # @param [Hash] attributes Model attributes in the form of hash
47
+ def initialize(attributes = {})
48
+ if (!attributes.is_a?(Hash))
49
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DearInventoryRuby::ExternalHeader` initialize method"
50
+ end
51
+
52
+ # check to see if the attribute exists and convert string to symbol for hash key
53
+ attributes = attributes.each_with_object({}) { |(k, v), h|
54
+ if (!self.class.attribute_map.key?(k.to_sym))
55
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DearInventoryRuby::ExternalHeader`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
56
+ end
57
+ h[k.to_sym] = v
58
+ }
59
+
60
+ if attributes.key?(:'key')
61
+ self.key = attributes[:'key']
62
+ end
63
+
64
+ if attributes.key?(:'value')
65
+ self.value = attributes[:'value']
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ invalid_properties
74
+ end
75
+
76
+ # Check to see if the all the properties in the model are valid
77
+ # @return true if the model is valid
78
+ def valid?
79
+ true
80
+ end
81
+
82
+ # Checks equality by comparing each attribute.
83
+ # @param [Object] Object to be compared
84
+ def ==(o)
85
+ return true if self.equal?(o)
86
+ self.class == o.class &&
87
+ key == o.key &&
88
+ value == o.value
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [key, value].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ new.build_from_hash(attributes)
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.openapi_types.each_pair do |key, type|
116
+ if type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :DateTime
137
+ DateTime.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ DearInventoryRuby.const_get(type).build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+ end
217
+ end
@@ -26,6 +26,7 @@ module DearInventoryRuby
26
26
  # Unit of measure for unit weight
27
27
  attr_accessor :default_weight_units
28
28
 
29
+ # Unit of measure for unit length/width/height
29
30
  attr_accessor :default_dimensions_units
30
31
 
31
32
  # Financial settings option. Indicates date period start from what you can change transactional data. Formatted in Tenant date format
@@ -54,7 +55,7 @@ module DearInventoryRuby
54
55
  :'currency' => :'String',
55
56
  :'time_zone' => :'String',
56
57
  :'default_weight_units' => :'String',
57
- :'default_dimensions_units' => :'DimensionsUnit',
58
+ :'default_dimensions_units' => :'String',
58
59
  :'lock_date' => :'Date',
59
60
  :'opening_balance_date' => :'Date'
60
61
  }
@@ -32,28 +32,6 @@ module DearInventoryRuby
32
32
  # Points that Payment Term is Default. `False` as default for POST.
33
33
  attr_accessor :is_default
34
34
 
35
- class EnumAttributeValidator
36
- attr_reader :datatype
37
- attr_reader :allowable_values
38
-
39
- def initialize(datatype, allowable_values)
40
- @allowable_values = allowable_values.map do |value|
41
- case datatype.to_s
42
- when /Integer/i
43
- value.to_i
44
- when /Float/i
45
- value.to_f
46
- else
47
- value
48
- end
49
- end
50
- end
51
-
52
- def valid?(value)
53
- !value || allowable_values.include?(value)
54
- end
55
- end
56
-
57
35
  # Attribute mapping from ruby-style variable name to JSON key.
58
36
  def self.attribute_map
59
37
  {
@@ -148,8 +126,6 @@ module DearInventoryRuby
148
126
  def valid?
149
127
  return false if @name.nil?
150
128
  return false if @name.to_s.length > 256
151
- method_validator = EnumAttributeValidator.new('String', ["number of days", "day of next month", "last day of next month", "days since the end of the month"])
152
- return false unless method_validator.valid?(@method)
153
129
  true
154
130
  end
155
131
 
@@ -167,16 +143,6 @@ module DearInventoryRuby
167
143
  @name = name
168
144
  end
169
145
 
170
- # Custom attribute writer method checking allowed values (enum).
171
- # @param [Object] method Object to be assigned
172
- def method=(method)
173
- validator = EnumAttributeValidator.new('String', ["number of days", "day of next month", "last day of next month", "days since the end of the month"])
174
- unless validator.valid?(method)
175
- fail ArgumentError, "invalid value for \"method\", must be one of #{validator.allowable_values}."
176
- end
177
- @method = method
178
- end
179
-
180
146
  # Checks equality by comparing each attribute.
181
147
  # @param [Object] Object to be compared
182
148
  def ==(o)