dear-inventory-ruby 0.2.9 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +14 -4
- data/docs/Bin.md +19 -0
- data/docs/Carrier.md +19 -0
- data/docs/Carriers.md +21 -0
- data/docs/InventoryApi.md +192 -4
- data/docs/Location.md +51 -0
- data/docs/Locations.md +21 -0
- data/docs/MeContact.md +33 -0
- data/docs/MeContacts.md +21 -0
- data/lib/dear-inventory-ruby/api/inventory_api.rb +193 -4
- data/lib/dear-inventory-ruby/models/account.rb +0 -76
- data/lib/dear-inventory-ruby/models/bin.rb +217 -0
- data/lib/dear-inventory-ruby/models/carrier.rb +217 -0
- data/lib/dear-inventory-ruby/models/carriers.rb +229 -0
- data/lib/dear-inventory-ruby/models/contact.rb +0 -94
- data/lib/dear-inventory-ruby/models/customer.rb +0 -34
- data/lib/dear-inventory-ruby/models/location.rb +391 -0
- data/lib/dear-inventory-ruby/models/locations.rb +229 -0
- data/lib/dear-inventory-ruby/models/me_contact.rb +289 -0
- data/lib/dear-inventory-ruby/models/me_contacts.rb +229 -0
- data/lib/dear-inventory-ruby/models/payment_term.rb +0 -19
- data/lib/dear-inventory-ruby/models/supplier_customer_address.rb +0 -75
- data/lib/dear-inventory-ruby/models/tax_component.rb +0 -19
- data/lib/dear-inventory-ruby/version.rb +1 -1
- data/lib/dear-inventory-ruby.rb +7 -0
- data/spec/.DS_Store +0 -0
- data/spec/api/inventory_api_spec.rb +41 -2
- data/spec/models/bin_spec.rb +47 -0
- data/spec/models/carrier_spec.rb +47 -0
- data/spec/models/carriers_spec.rb +53 -0
- data/spec/models/location_spec.rb +143 -0
- data/spec/models/locations_spec.rb +53 -0
- data/spec/models/me_contact_spec.rb +89 -0
- data/spec/models/me_contacts_spec.rb +53 -0
- metadata +30 -2
@@ -0,0 +1,289 @@
|
|
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 MeContact
|
17
|
+
# Unique `MeContact` ID
|
18
|
+
attr_accessor :contact_id
|
19
|
+
|
20
|
+
# Name of `MeContact`
|
21
|
+
attr_accessor :name
|
22
|
+
|
23
|
+
# Phone
|
24
|
+
attr_accessor :phone
|
25
|
+
|
26
|
+
# Fax
|
27
|
+
attr_accessor :fax
|
28
|
+
|
29
|
+
# Email
|
30
|
+
attr_accessor :email
|
31
|
+
|
32
|
+
# Website
|
33
|
+
attr_accessor :website
|
34
|
+
|
35
|
+
# Comment
|
36
|
+
attr_accessor :comment
|
37
|
+
|
38
|
+
# `MeContact` Type. Should be one of the following values: `Billing`, `Business`, `Sale`, `Shipping` or `Employee`
|
39
|
+
attr_accessor :type
|
40
|
+
|
41
|
+
# Points that `MeContact` is used as default for chosen `Type`. `False` as default.
|
42
|
+
attr_accessor :default_for_type
|
43
|
+
|
44
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
45
|
+
def self.attribute_map
|
46
|
+
{
|
47
|
+
:'contact_id' => :'ContactID',
|
48
|
+
:'name' => :'Name',
|
49
|
+
:'phone' => :'Phone',
|
50
|
+
:'fax' => :'Fax',
|
51
|
+
:'email' => :'Email',
|
52
|
+
:'website' => :'Website',
|
53
|
+
:'comment' => :'Comment',
|
54
|
+
:'type' => :'Type',
|
55
|
+
:'default_for_type' => :'DefaultForType'
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
# Attribute type mapping.
|
60
|
+
def self.openapi_types
|
61
|
+
{
|
62
|
+
:'contact_id' => :'String',
|
63
|
+
:'name' => :'String',
|
64
|
+
:'phone' => :'String',
|
65
|
+
:'fax' => :'String',
|
66
|
+
:'email' => :'String',
|
67
|
+
:'website' => :'String',
|
68
|
+
:'comment' => :'String',
|
69
|
+
:'type' => :'String',
|
70
|
+
:'default_for_type' => :'Boolean'
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
# List of attributes with nullable: true
|
75
|
+
def self.openapi_nullable
|
76
|
+
Set.new([
|
77
|
+
])
|
78
|
+
end
|
79
|
+
|
80
|
+
# Initializes the object
|
81
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
82
|
+
def initialize(attributes = {})
|
83
|
+
if (!attributes.is_a?(Hash))
|
84
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `DearInventoryRuby::MeContact` initialize method"
|
85
|
+
end
|
86
|
+
|
87
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
88
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
89
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
90
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `DearInventoryRuby::MeContact`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
91
|
+
end
|
92
|
+
h[k.to_sym] = v
|
93
|
+
}
|
94
|
+
|
95
|
+
if attributes.key?(:'contact_id')
|
96
|
+
self.contact_id = attributes[:'contact_id']
|
97
|
+
end
|
98
|
+
|
99
|
+
if attributes.key?(:'name')
|
100
|
+
self.name = attributes[:'name']
|
101
|
+
end
|
102
|
+
|
103
|
+
if attributes.key?(:'phone')
|
104
|
+
self.phone = attributes[:'phone']
|
105
|
+
end
|
106
|
+
|
107
|
+
if attributes.key?(:'fax')
|
108
|
+
self.fax = attributes[:'fax']
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.key?(:'email')
|
112
|
+
self.email = attributes[:'email']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.key?(:'website')
|
116
|
+
self.website = attributes[:'website']
|
117
|
+
end
|
118
|
+
|
119
|
+
if attributes.key?(:'comment')
|
120
|
+
self.comment = attributes[:'comment']
|
121
|
+
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
|
+
end
|
133
|
+
|
134
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
135
|
+
# @return Array for valid properties with the reasons
|
136
|
+
def list_invalid_properties
|
137
|
+
invalid_properties = Array.new
|
138
|
+
invalid_properties
|
139
|
+
end
|
140
|
+
|
141
|
+
# Check to see if the all the properties in the model are valid
|
142
|
+
# @return true if the model is valid
|
143
|
+
def valid?
|
144
|
+
true
|
145
|
+
end
|
146
|
+
|
147
|
+
# Checks equality by comparing each attribute.
|
148
|
+
# @param [Object] Object to be compared
|
149
|
+
def ==(o)
|
150
|
+
return true if self.equal?(o)
|
151
|
+
self.class == o.class &&
|
152
|
+
contact_id == o.contact_id &&
|
153
|
+
name == o.name &&
|
154
|
+
phone == o.phone &&
|
155
|
+
fax == o.fax &&
|
156
|
+
email == o.email &&
|
157
|
+
website == o.website &&
|
158
|
+
comment == o.comment &&
|
159
|
+
type == o.type &&
|
160
|
+
default_for_type == o.default_for_type
|
161
|
+
end
|
162
|
+
|
163
|
+
# @see the `==` method
|
164
|
+
# @param [Object] Object to be compared
|
165
|
+
def eql?(o)
|
166
|
+
self == o
|
167
|
+
end
|
168
|
+
|
169
|
+
# Calculates hash code according to all attributes.
|
170
|
+
# @return [Integer] Hash code
|
171
|
+
def hash
|
172
|
+
[contact_id, name, phone, fax, email, website, comment, type, default_for_type].hash
|
173
|
+
end
|
174
|
+
|
175
|
+
# Builds the object from hash
|
176
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
177
|
+
# @return [Object] Returns the model itself
|
178
|
+
def self.build_from_hash(attributes)
|
179
|
+
new.build_from_hash(attributes)
|
180
|
+
end
|
181
|
+
|
182
|
+
# Builds the object from hash
|
183
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
184
|
+
# @return [Object] Returns the model itself
|
185
|
+
def build_from_hash(attributes)
|
186
|
+
return nil unless attributes.is_a?(Hash)
|
187
|
+
self.class.openapi_types.each_pair do |key, type|
|
188
|
+
if type =~ /\AArray<(.*)>/i
|
189
|
+
# check to ensure the input is an array given that the attribute
|
190
|
+
# is documented as an array but the input is not
|
191
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
192
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
193
|
+
end
|
194
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
195
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
196
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
197
|
+
end
|
198
|
+
|
199
|
+
self
|
200
|
+
end
|
201
|
+
|
202
|
+
# Deserializes the data based on type
|
203
|
+
# @param string type Data type
|
204
|
+
# @param string value Value to be deserialized
|
205
|
+
# @return [Object] Deserialized data
|
206
|
+
def _deserialize(type, value)
|
207
|
+
case type.to_sym
|
208
|
+
when :DateTime
|
209
|
+
DateTime.parse(value)
|
210
|
+
when :Date
|
211
|
+
Date.parse(value)
|
212
|
+
when :String
|
213
|
+
value.to_s
|
214
|
+
when :Integer
|
215
|
+
value.to_i
|
216
|
+
when :Float
|
217
|
+
value.to_f
|
218
|
+
when :Boolean
|
219
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
220
|
+
true
|
221
|
+
else
|
222
|
+
false
|
223
|
+
end
|
224
|
+
when :Object
|
225
|
+
# generic object (usually a Hash), return directly
|
226
|
+
value
|
227
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
228
|
+
inner_type = Regexp.last_match[:inner_type]
|
229
|
+
value.map { |v| _deserialize(inner_type, v) }
|
230
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
231
|
+
k_type = Regexp.last_match[:k_type]
|
232
|
+
v_type = Regexp.last_match[:v_type]
|
233
|
+
{}.tap do |hash|
|
234
|
+
value.each do |k, v|
|
235
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
else # model
|
239
|
+
DearInventoryRuby.const_get(type).build_from_hash(value)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
# Returns the string representation of the object
|
244
|
+
# @return [String] String presentation of the object
|
245
|
+
def to_s
|
246
|
+
to_hash.to_s
|
247
|
+
end
|
248
|
+
|
249
|
+
# to_body is an alias to to_hash (backward compatibility)
|
250
|
+
# @return [Hash] Returns the object in the form of hash
|
251
|
+
def to_body
|
252
|
+
to_hash
|
253
|
+
end
|
254
|
+
|
255
|
+
# Returns the object in the form of hash
|
256
|
+
# @return [Hash] Returns the object in the form of hash
|
257
|
+
def to_hash
|
258
|
+
hash = {}
|
259
|
+
self.class.attribute_map.each_pair do |attr, param|
|
260
|
+
value = self.send(attr)
|
261
|
+
if value.nil?
|
262
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
263
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
264
|
+
end
|
265
|
+
|
266
|
+
hash[param] = _to_hash(value)
|
267
|
+
end
|
268
|
+
hash
|
269
|
+
end
|
270
|
+
|
271
|
+
# Outputs non-array value in the form of hash
|
272
|
+
# For object, use to_hash. Otherwise, just return the value
|
273
|
+
# @param [Object] value Any valid value
|
274
|
+
# @return [Hash] Returns the value in the form of hash
|
275
|
+
def _to_hash(value)
|
276
|
+
if value.is_a?(Array)
|
277
|
+
value.compact.map { |v| _to_hash(v) }
|
278
|
+
elsif value.is_a?(Hash)
|
279
|
+
{}.tap do |hash|
|
280
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
281
|
+
end
|
282
|
+
elsif value.respond_to? :to_hash
|
283
|
+
value.to_hash
|
284
|
+
else
|
285
|
+
value
|
286
|
+
end
|
287
|
+
end
|
288
|
+
end
|
289
|
+
end
|
@@ -0,0 +1,229 @@
|
|
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 MeContacts
|
17
|
+
# Total
|
18
|
+
attr_accessor :total
|
19
|
+
|
20
|
+
# Page
|
21
|
+
attr_accessor :page
|
22
|
+
|
23
|
+
# Array of MeContacts
|
24
|
+
attr_accessor :me_contacts_list
|
25
|
+
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
27
|
+
def self.attribute_map
|
28
|
+
{
|
29
|
+
:'total' => :'Total',
|
30
|
+
:'page' => :'Page',
|
31
|
+
:'me_contacts_list' => :'MeContactsList'
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.openapi_types
|
37
|
+
{
|
38
|
+
:'total' => :'Float',
|
39
|
+
:'page' => :'Float',
|
40
|
+
:'me_contacts_list' => :'Array<MeContact>'
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# List of attributes with nullable: true
|
45
|
+
def self.openapi_nullable
|
46
|
+
Set.new([
|
47
|
+
])
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
if (!attributes.is_a?(Hash))
|
54
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `DearInventoryRuby::MeContacts` initialize method"
|
55
|
+
end
|
56
|
+
|
57
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
58
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
59
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
60
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `DearInventoryRuby::MeContacts`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
61
|
+
end
|
62
|
+
h[k.to_sym] = v
|
63
|
+
}
|
64
|
+
|
65
|
+
if attributes.key?(:'total')
|
66
|
+
self.total = attributes[:'total']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.key?(:'page')
|
70
|
+
self.page = attributes[:'page']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.key?(:'me_contacts_list')
|
74
|
+
if (value = attributes[:'me_contacts_list']).is_a?(Array)
|
75
|
+
self.me_contacts_list = value
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
81
|
+
# @return Array for valid properties with the reasons
|
82
|
+
def list_invalid_properties
|
83
|
+
invalid_properties = Array.new
|
84
|
+
invalid_properties
|
85
|
+
end
|
86
|
+
|
87
|
+
# Check to see if the all the properties in the model are valid
|
88
|
+
# @return true if the model is valid
|
89
|
+
def valid?
|
90
|
+
true
|
91
|
+
end
|
92
|
+
|
93
|
+
# Checks equality by comparing each attribute.
|
94
|
+
# @param [Object] Object to be compared
|
95
|
+
def ==(o)
|
96
|
+
return true if self.equal?(o)
|
97
|
+
self.class == o.class &&
|
98
|
+
total == o.total &&
|
99
|
+
page == o.page &&
|
100
|
+
me_contacts_list == o.me_contacts_list
|
101
|
+
end
|
102
|
+
|
103
|
+
# @see the `==` method
|
104
|
+
# @param [Object] Object to be compared
|
105
|
+
def eql?(o)
|
106
|
+
self == o
|
107
|
+
end
|
108
|
+
|
109
|
+
# Calculates hash code according to all attributes.
|
110
|
+
# @return [Integer] Hash code
|
111
|
+
def hash
|
112
|
+
[total, page, me_contacts_list].hash
|
113
|
+
end
|
114
|
+
|
115
|
+
# Builds the object from hash
|
116
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
117
|
+
# @return [Object] Returns the model itself
|
118
|
+
def self.build_from_hash(attributes)
|
119
|
+
new.build_from_hash(attributes)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Builds the object from hash
|
123
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
124
|
+
# @return [Object] Returns the model itself
|
125
|
+
def build_from_hash(attributes)
|
126
|
+
return nil unless attributes.is_a?(Hash)
|
127
|
+
self.class.openapi_types.each_pair do |key, type|
|
128
|
+
if type =~ /\AArray<(.*)>/i
|
129
|
+
# check to ensure the input is an array given that the attribute
|
130
|
+
# is documented as an array but the input is not
|
131
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
132
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
133
|
+
end
|
134
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
135
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
136
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
137
|
+
end
|
138
|
+
|
139
|
+
self
|
140
|
+
end
|
141
|
+
|
142
|
+
# Deserializes the data based on type
|
143
|
+
# @param string type Data type
|
144
|
+
# @param string value Value to be deserialized
|
145
|
+
# @return [Object] Deserialized data
|
146
|
+
def _deserialize(type, value)
|
147
|
+
case type.to_sym
|
148
|
+
when :DateTime
|
149
|
+
DateTime.parse(value)
|
150
|
+
when :Date
|
151
|
+
Date.parse(value)
|
152
|
+
when :String
|
153
|
+
value.to_s
|
154
|
+
when :Integer
|
155
|
+
value.to_i
|
156
|
+
when :Float
|
157
|
+
value.to_f
|
158
|
+
when :Boolean
|
159
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
160
|
+
true
|
161
|
+
else
|
162
|
+
false
|
163
|
+
end
|
164
|
+
when :Object
|
165
|
+
# generic object (usually a Hash), return directly
|
166
|
+
value
|
167
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
168
|
+
inner_type = Regexp.last_match[:inner_type]
|
169
|
+
value.map { |v| _deserialize(inner_type, v) }
|
170
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
171
|
+
k_type = Regexp.last_match[:k_type]
|
172
|
+
v_type = Regexp.last_match[:v_type]
|
173
|
+
{}.tap do |hash|
|
174
|
+
value.each do |k, v|
|
175
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
176
|
+
end
|
177
|
+
end
|
178
|
+
else # model
|
179
|
+
DearInventoryRuby.const_get(type).build_from_hash(value)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# Returns the string representation of the object
|
184
|
+
# @return [String] String presentation of the object
|
185
|
+
def to_s
|
186
|
+
to_hash.to_s
|
187
|
+
end
|
188
|
+
|
189
|
+
# to_body is an alias to to_hash (backward compatibility)
|
190
|
+
# @return [Hash] Returns the object in the form of hash
|
191
|
+
def to_body
|
192
|
+
to_hash
|
193
|
+
end
|
194
|
+
|
195
|
+
# Returns the object in the form of hash
|
196
|
+
# @return [Hash] Returns the object in the form of hash
|
197
|
+
def to_hash
|
198
|
+
hash = {}
|
199
|
+
self.class.attribute_map.each_pair do |attr, param|
|
200
|
+
value = self.send(attr)
|
201
|
+
if value.nil?
|
202
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
203
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
204
|
+
end
|
205
|
+
|
206
|
+
hash[param] = _to_hash(value)
|
207
|
+
end
|
208
|
+
hash
|
209
|
+
end
|
210
|
+
|
211
|
+
# Outputs non-array value in the form of hash
|
212
|
+
# For object, use to_hash. Otherwise, just return the value
|
213
|
+
# @param [Object] value Any valid value
|
214
|
+
# @return [Hash] Returns the value in the form of hash
|
215
|
+
def _to_hash(value)
|
216
|
+
if value.is_a?(Array)
|
217
|
+
value.compact.map { |v| _to_hash(v) }
|
218
|
+
elsif value.is_a?(Hash)
|
219
|
+
{}.tap do |hash|
|
220
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
221
|
+
end
|
222
|
+
elsif value.respond_to? :to_hash
|
223
|
+
value.to_hash
|
224
|
+
else
|
225
|
+
value
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
@@ -114,10 +114,6 @@ module DearInventoryRuby
|
|
114
114
|
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
115
115
|
end
|
116
116
|
|
117
|
-
if @name.to_s.length > 256
|
118
|
-
invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 256.')
|
119
|
-
end
|
120
|
-
|
121
117
|
invalid_properties
|
122
118
|
end
|
123
119
|
|
@@ -125,24 +121,9 @@ module DearInventoryRuby
|
|
125
121
|
# @return true if the model is valid
|
126
122
|
def valid?
|
127
123
|
return false if @name.nil?
|
128
|
-
return false if @name.to_s.length > 256
|
129
124
|
true
|
130
125
|
end
|
131
126
|
|
132
|
-
# Custom attribute writer method with validation
|
133
|
-
# @param [Object] name Value to be assigned
|
134
|
-
def name=(name)
|
135
|
-
if name.nil?
|
136
|
-
fail ArgumentError, 'name cannot be nil'
|
137
|
-
end
|
138
|
-
|
139
|
-
if name.to_s.length > 256
|
140
|
-
fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 256.'
|
141
|
-
end
|
142
|
-
|
143
|
-
@name = name
|
144
|
-
end
|
145
|
-
|
146
127
|
# Checks equality by comparing each attribute.
|
147
128
|
# @param [Object] Object to be compared
|
148
129
|
def ==(o)
|
@@ -135,26 +135,6 @@ module DearInventoryRuby
|
|
135
135
|
# @return Array for valid properties with the reasons
|
136
136
|
def list_invalid_properties
|
137
137
|
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.')
|
156
|
-
end
|
157
|
-
|
158
138
|
if @country.nil?
|
159
139
|
invalid_properties.push('invalid value for "country", country cannot be nil.')
|
160
140
|
end
|
@@ -169,66 +149,11 @@ module DearInventoryRuby
|
|
169
149
|
# Check to see if the all the properties in the model are valid
|
170
150
|
# @return true if the model is valid
|
171
151
|
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
|
177
152
|
return false if @country.nil?
|
178
153
|
return false if @type.nil?
|
179
154
|
true
|
180
155
|
end
|
181
156
|
|
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
157
|
# Checks equality by comparing each attribute.
|
233
158
|
# @param [Object] Object to be compared
|
234
159
|
def ==(o)
|
@@ -94,10 +94,6 @@ module DearInventoryRuby
|
|
94
94
|
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
95
95
|
end
|
96
96
|
|
97
|
-
if @name.to_s.length > 50
|
98
|
-
invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 50.')
|
99
|
-
end
|
100
|
-
|
101
97
|
if @percent.nil?
|
102
98
|
invalid_properties.push('invalid value for "percent", percent cannot be nil.')
|
103
99
|
end
|
@@ -125,7 +121,6 @@ module DearInventoryRuby
|
|
125
121
|
# @return true if the model is valid
|
126
122
|
def valid?
|
127
123
|
return false if @name.nil?
|
128
|
-
return false if @name.to_s.length > 50
|
129
124
|
return false if @percent.nil?
|
130
125
|
return false if @percent > 100
|
131
126
|
return false if @percent < 0
|
@@ -134,20 +129,6 @@ module DearInventoryRuby
|
|
134
129
|
true
|
135
130
|
end
|
136
131
|
|
137
|
-
# Custom attribute writer method with validation
|
138
|
-
# @param [Object] name Value to be assigned
|
139
|
-
def name=(name)
|
140
|
-
if name.nil?
|
141
|
-
fail ArgumentError, 'name cannot be nil'
|
142
|
-
end
|
143
|
-
|
144
|
-
if name.to_s.length > 50
|
145
|
-
fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 50.'
|
146
|
-
end
|
147
|
-
|
148
|
-
@name = name
|
149
|
-
end
|
150
|
-
|
151
132
|
# Custom attribute writer method with validation
|
152
133
|
# @param [Object] percent Value to be assigned
|
153
134
|
def percent=(percent)
|