dear-inventory-ruby 0.2.10.1 → 0.2.12
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/CHANGELOG.md +11 -0
- data/README.md +14 -4
- data/docs/Account.md +15 -15
- data/docs/Accounts.md +3 -3
- data/docs/Address.md +8 -8
- data/docs/AttachmentLine.md +5 -5
- data/docs/Bin.md +19 -0
- data/docs/Carrier.md +19 -0
- data/docs/Carriers.md +21 -0
- data/docs/Contact.md +9 -9
- data/docs/Customer.md +31 -31
- data/docs/Customers.md +3 -3
- data/docs/Error.md +2 -2
- data/docs/ExternalHeader.md +2 -2
- data/docs/InventoryApi.md +252 -64
- data/docs/Location.md +51 -0
- data/docs/Locations.md +21 -0
- data/docs/Me.md +7 -7
- data/docs/MeContact.md +33 -0
- data/docs/MeContacts.md +21 -0
- data/docs/PaymentTerm.md +4 -4
- data/docs/PaymentTerms.md +3 -3
- data/docs/PriceTier.md +2 -2
- data/docs/PriceTiers.md +1 -1
- data/docs/Sale.md +43 -43
- data/docs/SaleAdditionalCharge.md +8 -8
- data/docs/SaleInvoice.md +17 -17
- data/docs/SaleInvoiceAdditionalCharge.md +9 -9
- data/docs/SaleInvoiceDelete.md +1 -1
- data/docs/SaleInvoiceLine.md +12 -12
- data/docs/SaleInvoicePartial.md +12 -12
- data/docs/SaleInvoicePost.md +12 -12
- data/docs/SaleInvoices.md +2 -2
- data/docs/SaleItem.md +31 -31
- data/docs/SaleList.md +3 -3
- data/docs/SaleOrder.md +9 -9
- data/docs/SaleOrderLine.md +13 -13
- data/docs/SalePayment.md +14 -14
- data/docs/SalePaymentLine.md +7 -7
- data/docs/SaleQuote.md +8 -8
- data/docs/SaleQuoteLine.md +11 -11
- data/docs/ShippingAddress.md +11 -11
- data/docs/Success.md +1 -1
- data/docs/SupplierCustomerAddress.md +9 -9
- data/docs/Tax.md +5 -5
- data/docs/TaxComponent.md +3 -3
- data/docs/Taxes.md +3 -3
- data/docs/Webhook.md +10 -10
- data/docs/Webhooks.md +1 -1
- data/lib/dear-inventory-ruby/api/inventory_api.rb +193 -4
- 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/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/supplier_customer_address.rb +7 -7
- 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
- data/spec/models/supplier_customer_address_spec.rb +1 -1
- metadata +31 -7
@@ -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
|
@@ -30,7 +30,7 @@ module DearInventoryRuby
|
|
30
30
|
attr_accessor :state
|
31
31
|
|
32
32
|
# Zip / PostCode
|
33
|
-
attr_accessor :
|
33
|
+
attr_accessor :postcode
|
34
34
|
|
35
35
|
# Country name
|
36
36
|
attr_accessor :country
|
@@ -49,7 +49,7 @@ module DearInventoryRuby
|
|
49
49
|
:'line2' => :'Line2',
|
50
50
|
:'city' => :'City',
|
51
51
|
:'state' => :'State',
|
52
|
-
:'
|
52
|
+
:'postcode' => :'Postcode',
|
53
53
|
:'country' => :'Country',
|
54
54
|
:'type' => :'Type',
|
55
55
|
:'default_for_type' => :'DefaultForType'
|
@@ -64,7 +64,7 @@ module DearInventoryRuby
|
|
64
64
|
:'line2' => :'String',
|
65
65
|
:'city' => :'String',
|
66
66
|
:'state' => :'String',
|
67
|
-
:'
|
67
|
+
:'postcode' => :'String',
|
68
68
|
:'country' => :'String',
|
69
69
|
:'type' => :'String',
|
70
70
|
:'default_for_type' => :'Boolean'
|
@@ -112,8 +112,8 @@ module DearInventoryRuby
|
|
112
112
|
self.state = attributes[:'state']
|
113
113
|
end
|
114
114
|
|
115
|
-
if attributes.key?(:'
|
116
|
-
self.
|
115
|
+
if attributes.key?(:'postcode')
|
116
|
+
self.postcode = attributes[:'postcode']
|
117
117
|
end
|
118
118
|
|
119
119
|
if attributes.key?(:'country')
|
@@ -164,7 +164,7 @@ module DearInventoryRuby
|
|
164
164
|
line2 == o.line2 &&
|
165
165
|
city == o.city &&
|
166
166
|
state == o.state &&
|
167
|
-
|
167
|
+
postcode == o.postcode &&
|
168
168
|
country == o.country &&
|
169
169
|
type == o.type &&
|
170
170
|
default_for_type == o.default_for_type
|
@@ -179,7 +179,7 @@ module DearInventoryRuby
|
|
179
179
|
# Calculates hash code according to all attributes.
|
180
180
|
# @return [Integer] Hash code
|
181
181
|
def hash
|
182
|
-
[id, line1, line2, city, state,
|
182
|
+
[id, line1, line2, city, state, postcode, country, type, default_for_type].hash
|
183
183
|
end
|
184
184
|
|
185
185
|
# Builds the object from hash
|
data/lib/dear-inventory-ruby.rb
CHANGED
@@ -22,12 +22,19 @@ require 'dear-inventory-ruby/models/accounts'
|
|
22
22
|
require 'dear-inventory-ruby/models/address'
|
23
23
|
require 'dear-inventory-ruby/models/attachment_line'
|
24
24
|
require 'dear-inventory-ruby/models/authorization_type'
|
25
|
+
require 'dear-inventory-ruby/models/bin'
|
26
|
+
require 'dear-inventory-ruby/models/carrier'
|
27
|
+
require 'dear-inventory-ruby/models/carriers'
|
25
28
|
require 'dear-inventory-ruby/models/contact'
|
26
29
|
require 'dear-inventory-ruby/models/customer'
|
27
30
|
require 'dear-inventory-ruby/models/customers'
|
28
31
|
require 'dear-inventory-ruby/models/error'
|
29
32
|
require 'dear-inventory-ruby/models/external_header'
|
33
|
+
require 'dear-inventory-ruby/models/location'
|
34
|
+
require 'dear-inventory-ruby/models/locations'
|
30
35
|
require 'dear-inventory-ruby/models/me'
|
36
|
+
require 'dear-inventory-ruby/models/me_contact'
|
37
|
+
require 'dear-inventory-ruby/models/me_contacts'
|
31
38
|
require 'dear-inventory-ruby/models/payment_term'
|
32
39
|
require 'dear-inventory-ruby/models/payment_terms'
|
33
40
|
require 'dear-inventory-ruby/models/price_tier'
|
data/spec/.DS_Store
CHANGED
Binary file
|
@@ -213,6 +213,20 @@ describe 'InventoryApi' do
|
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
216
|
+
# unit tests for get_carriers
|
217
|
+
# Allows you to retrieve the carriers
|
218
|
+
# @param [Hash] opts the optional parameters
|
219
|
+
# @option opts [String] :page Default is 1
|
220
|
+
# @option opts [String] :limit Default is 100
|
221
|
+
# @option opts [String] :carrier_id Only return Carrier with the specific CarrierID
|
222
|
+
# @option opts [String] :description Only return Carriers that start with the specific Description
|
223
|
+
# @return [Carriers]
|
224
|
+
describe 'get_carriers test' do
|
225
|
+
it 'should work' do
|
226
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
216
230
|
# unit tests for get_customers
|
217
231
|
# Allows you to retrieve the customers
|
218
232
|
# @param [Hash] opts the optional parameters
|
@@ -222,8 +236,8 @@ describe 'InventoryApi' do
|
|
222
236
|
# @option opts [String] :name Default is nil
|
223
237
|
# @option opts [String] :contact_filter Default is nil
|
224
238
|
# @option opts [String] :modified_since Default is nil
|
225
|
-
# @option opts [
|
226
|
-
# @option opts [
|
239
|
+
# @option opts [Boolean] :include_deprecated Default is false
|
240
|
+
# @option opts [Boolean] :include_product_prices Default is false
|
227
241
|
# @return [Customers]
|
228
242
|
describe 'get_customers test' do
|
229
243
|
it 'should work' do
|
@@ -231,6 +245,21 @@ describe 'InventoryApi' do
|
|
231
245
|
end
|
232
246
|
end
|
233
247
|
|
248
|
+
# unit tests for get_locations
|
249
|
+
# Allows you to retrieve the locations
|
250
|
+
# @param [Hash] opts the optional parameters
|
251
|
+
# @option opts [String] :page Default is 1
|
252
|
+
# @option opts [String] :limit Default is 100
|
253
|
+
# @option opts [String] :id Default is nil
|
254
|
+
# @option opts [Boolean] :deprecated Default is false
|
255
|
+
# @option opts [String] :name Default is nil
|
256
|
+
# @return [Locations]
|
257
|
+
describe 'get_locations test' do
|
258
|
+
it 'should work' do
|
259
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
234
263
|
# unit tests for get_me
|
235
264
|
# Allows you to retrieve your information
|
236
265
|
# @param [Hash] opts the optional parameters
|
@@ -241,6 +270,16 @@ describe 'InventoryApi' do
|
|
241
270
|
end
|
242
271
|
end
|
243
272
|
|
273
|
+
# unit tests for get_me_contacts
|
274
|
+
# Allows you to retrieve the me contacts (Sales Representatives)
|
275
|
+
# @param [Hash] opts the optional parameters
|
276
|
+
# @return [MeContacts]
|
277
|
+
describe 'get_me_contacts test' do
|
278
|
+
it 'should work' do
|
279
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
244
283
|
# unit tests for get_payment_terms
|
245
284
|
# Allows you to retrieve the payment terms
|
246
285
|
# @param [Hash] opts the optional parameters
|