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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +11 -4
- data/docs/Account.md +17 -19
- data/docs/Accounts.md +5 -7
- data/docs/Address.md +10 -12
- data/docs/AttachmentLine.md +7 -9
- data/docs/AttributeSet.md +79 -0
- data/docs/AttributeSetAttribute.md +19 -0
- data/docs/AttributeSets.md +19 -0
- data/docs/Bin.md +4 -6
- data/docs/Carrier.md +4 -6
- data/docs/Carriers.md +5 -7
- data/docs/Contact.md +13 -15
- data/docs/Customer.md +34 -36
- data/docs/Customers.md +5 -7
- data/docs/Error.md +4 -6
- data/docs/ExternalHeader.md +4 -6
- data/docs/InventoryApi.md +446 -274
- data/docs/Location.md +20 -22
- data/docs/Locations.md +5 -7
- data/docs/Me.md +9 -11
- data/docs/MeContact.md +11 -13
- data/docs/MeContacts.md +5 -7
- data/docs/PaymentTerm.md +8 -10
- data/docs/PaymentTerms.md +5 -7
- data/docs/PriceTier.md +4 -6
- data/docs/PriceTiers.md +3 -5
- data/docs/Sale.md +45 -47
- data/docs/SaleAdditionalCharge.md +10 -12
- data/docs/SaleInvoice.md +19 -21
- data/docs/SaleInvoiceAdditionalCharge.md +11 -13
- data/docs/SaleInvoiceDelete.md +4 -6
- data/docs/SaleInvoiceLine.md +14 -16
- data/docs/SaleInvoicePartial.md +15 -17
- data/docs/SaleInvoicePost.md +15 -17
- data/docs/SaleInvoices.md +4 -6
- data/docs/SaleItem.md +33 -35
- data/docs/SaleList.md +5 -7
- data/docs/SaleOrder.md +12 -14
- data/docs/SaleOrderLine.md +15 -17
- data/docs/SalePayment.md +16 -18
- data/docs/SalePaymentLine.md +9 -11
- data/docs/SaleQuote.md +11 -13
- data/docs/SaleQuoteLine.md +13 -15
- data/docs/ShippingAddress.md +13 -15
- data/docs/Success.md +3 -5
- data/docs/SupplierCustomerAddress.md +11 -13
- data/docs/Tax.md +11 -13
- data/docs/TaxComponent.md +6 -8
- data/docs/Taxes.md +5 -7
- data/docs/Webhook.md +12 -14
- data/docs/Webhooks.md +3 -5
- data/lib/dear-inventory-ruby/api/inventory_api.rb +253 -0
- data/lib/dear-inventory-ruby/models/attribute_set.rb +534 -0
- data/lib/dear-inventory-ruby/models/attribute_set_attribute.rb +237 -0
- data/lib/dear-inventory-ruby/models/attribute_sets.rb +229 -0
- data/lib/dear-inventory-ruby/version.rb +1 -1
- data/lib/dear-inventory-ruby.rb +3 -0
- data/spec/.DS_Store +0 -0
- data/spec/api/inventory_api_spec.rb +49 -0
- data/spec/models/attribute_set_attribute_spec.rb +53 -0
- data/spec/models/attribute_set_spec.rb +233 -0
- data/spec/models/attribute_sets_spec.rb +53 -0
- metadata +53 -41
|
@@ -0,0 +1,237 @@
|
|
|
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 AttributeSetAttribute
|
|
17
|
+
# Name of the attribute
|
|
18
|
+
attr_accessor :name
|
|
19
|
+
|
|
20
|
+
# Type of the attribute. Should be one of the following values: `Text`, `List`, `Checkbox`, `Not used`, `Date`, `Numeric`
|
|
21
|
+
attr_accessor :type
|
|
22
|
+
|
|
23
|
+
# Comma-separated list of values (applicable when Type is List)
|
|
24
|
+
attr_accessor :values
|
|
25
|
+
|
|
26
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
27
|
+
def self.attribute_map
|
|
28
|
+
{
|
|
29
|
+
:'name' => :'Name',
|
|
30
|
+
:'type' => :'Type',
|
|
31
|
+
:'values' => :'Values'
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Attribute type mapping.
|
|
36
|
+
def self.openapi_types
|
|
37
|
+
{
|
|
38
|
+
:'name' => :'String',
|
|
39
|
+
:'type' => :'String',
|
|
40
|
+
:'values' => :'String'
|
|
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::AttributeSetAttribute` 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::AttributeSetAttribute`. 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?(:'name')
|
|
66
|
+
self.name = attributes[:'name']
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
if attributes.key?(:'type')
|
|
70
|
+
self.type = attributes[:'type']
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
if attributes.key?(:'values')
|
|
74
|
+
self.values = attributes[:'values']
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
79
|
+
# @return Array for valid properties with the reasons
|
|
80
|
+
def list_invalid_properties
|
|
81
|
+
invalid_properties = Array.new
|
|
82
|
+
if @name.nil?
|
|
83
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
if @type.nil?
|
|
87
|
+
invalid_properties.push('invalid value for "type", type cannot be nil.')
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
invalid_properties
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Check to see if the all the properties in the model are valid
|
|
94
|
+
# @return true if the model is valid
|
|
95
|
+
def valid?
|
|
96
|
+
return false if @name.nil?
|
|
97
|
+
return false if @type.nil?
|
|
98
|
+
true
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Checks equality by comparing each attribute.
|
|
102
|
+
# @param [Object] Object to be compared
|
|
103
|
+
def ==(o)
|
|
104
|
+
return true if self.equal?(o)
|
|
105
|
+
self.class == o.class &&
|
|
106
|
+
name == o.name &&
|
|
107
|
+
type == o.type &&
|
|
108
|
+
values == o.values
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# @see the `==` method
|
|
112
|
+
# @param [Object] Object to be compared
|
|
113
|
+
def eql?(o)
|
|
114
|
+
self == o
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Calculates hash code according to all attributes.
|
|
118
|
+
# @return [Integer] Hash code
|
|
119
|
+
def hash
|
|
120
|
+
[name, type, values].hash
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Builds the object from hash
|
|
124
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
125
|
+
# @return [Object] Returns the model itself
|
|
126
|
+
def self.build_from_hash(attributes)
|
|
127
|
+
new.build_from_hash(attributes)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# Builds the object from hash
|
|
131
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
132
|
+
# @return [Object] Returns the model itself
|
|
133
|
+
def build_from_hash(attributes)
|
|
134
|
+
return nil unless attributes.is_a?(Hash)
|
|
135
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
136
|
+
if type =~ /\AArray<(.*)>/i
|
|
137
|
+
# check to ensure the input is an array given that the attribute
|
|
138
|
+
# is documented as an array but the input is not
|
|
139
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
140
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
141
|
+
end
|
|
142
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
143
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
144
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
self
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Deserializes the data based on type
|
|
151
|
+
# @param string type Data type
|
|
152
|
+
# @param string value Value to be deserialized
|
|
153
|
+
# @return [Object] Deserialized data
|
|
154
|
+
def _deserialize(type, value)
|
|
155
|
+
case type.to_sym
|
|
156
|
+
when :DateTime
|
|
157
|
+
DateTime.parse(value)
|
|
158
|
+
when :Date
|
|
159
|
+
Date.parse(value)
|
|
160
|
+
when :String
|
|
161
|
+
value.to_s
|
|
162
|
+
when :Integer
|
|
163
|
+
value.to_i
|
|
164
|
+
when :Float
|
|
165
|
+
value.to_f
|
|
166
|
+
when :Boolean
|
|
167
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
168
|
+
true
|
|
169
|
+
else
|
|
170
|
+
false
|
|
171
|
+
end
|
|
172
|
+
when :Object
|
|
173
|
+
# generic object (usually a Hash), return directly
|
|
174
|
+
value
|
|
175
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
176
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
177
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
178
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
179
|
+
k_type = Regexp.last_match[:k_type]
|
|
180
|
+
v_type = Regexp.last_match[:v_type]
|
|
181
|
+
{}.tap do |hash|
|
|
182
|
+
value.each do |k, v|
|
|
183
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
else # model
|
|
187
|
+
DearInventoryRuby.const_get(type).build_from_hash(value)
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Returns the string representation of the object
|
|
192
|
+
# @return [String] String presentation of the object
|
|
193
|
+
def to_s
|
|
194
|
+
to_hash.to_s
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
198
|
+
# @return [Hash] Returns the object in the form of hash
|
|
199
|
+
def to_body
|
|
200
|
+
to_hash
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# Returns the object in the form of hash
|
|
204
|
+
# @return [Hash] Returns the object in the form of hash
|
|
205
|
+
def to_hash
|
|
206
|
+
hash = {}
|
|
207
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
208
|
+
value = self.send(attr)
|
|
209
|
+
if value.nil?
|
|
210
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
211
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
hash[param] = _to_hash(value)
|
|
215
|
+
end
|
|
216
|
+
hash
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# Outputs non-array value in the form of hash
|
|
220
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
221
|
+
# @param [Object] value Any valid value
|
|
222
|
+
# @return [Hash] Returns the value in the form of hash
|
|
223
|
+
def _to_hash(value)
|
|
224
|
+
if value.is_a?(Array)
|
|
225
|
+
value.compact.map { |v| _to_hash(v) }
|
|
226
|
+
elsif value.is_a?(Hash)
|
|
227
|
+
{}.tap do |hash|
|
|
228
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
229
|
+
end
|
|
230
|
+
elsif value.respond_to? :to_hash
|
|
231
|
+
value.to_hash
|
|
232
|
+
else
|
|
233
|
+
value
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
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 AttributeSets
|
|
17
|
+
# Total
|
|
18
|
+
attr_accessor :total
|
|
19
|
+
|
|
20
|
+
# Page
|
|
21
|
+
attr_accessor :page
|
|
22
|
+
|
|
23
|
+
# Array of Attribute Sets
|
|
24
|
+
attr_accessor :attribute_set_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
|
+
:'attribute_set_list' => :'AttributeSetList'
|
|
32
|
+
}
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Attribute type mapping.
|
|
36
|
+
def self.openapi_types
|
|
37
|
+
{
|
|
38
|
+
:'total' => :'Float',
|
|
39
|
+
:'page' => :'Float',
|
|
40
|
+
:'attribute_set_list' => :'Array<AttributeSet>'
|
|
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::AttributeSets` 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::AttributeSets`. 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?(:'attribute_set_list')
|
|
74
|
+
if (value = attributes[:'attribute_set_list']).is_a?(Array)
|
|
75
|
+
self.attribute_set_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
|
+
attribute_set_list == o.attribute_set_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, attribute_set_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
|
data/lib/dear-inventory-ruby.rb
CHANGED
|
@@ -21,6 +21,9 @@ require 'dear-inventory-ruby/models/account'
|
|
|
21
21
|
require 'dear-inventory-ruby/models/accounts'
|
|
22
22
|
require 'dear-inventory-ruby/models/address'
|
|
23
23
|
require 'dear-inventory-ruby/models/attachment_line'
|
|
24
|
+
require 'dear-inventory-ruby/models/attribute_set'
|
|
25
|
+
require 'dear-inventory-ruby/models/attribute_set_attribute'
|
|
26
|
+
require 'dear-inventory-ruby/models/attribute_sets'
|
|
24
27
|
require 'dear-inventory-ruby/models/authorization_type'
|
|
25
28
|
require 'dear-inventory-ruby/models/bin'
|
|
26
29
|
require 'dear-inventory-ruby/models/carrier'
|
data/spec/.DS_Store
CHANGED
|
Binary file
|
|
@@ -44,6 +44,18 @@ describe 'InventoryApi' do
|
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
# unit tests for create_attribute_set
|
|
48
|
+
# Allows you to create an attribute set
|
|
49
|
+
# @param attribute_set an attribute set object with properties to create
|
|
50
|
+
# @param [Hash] opts the optional parameters
|
|
51
|
+
# @option opts [Boolean] :summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors
|
|
52
|
+
# @return [AttributeSet]
|
|
53
|
+
describe 'create_attribute_set test' do
|
|
54
|
+
it 'should work' do
|
|
55
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
47
59
|
# unit tests for create_customer
|
|
48
60
|
# Allows you to create a customer
|
|
49
61
|
# @param customer a customer object with properties to create
|
|
@@ -151,6 +163,17 @@ describe 'InventoryApi' do
|
|
|
151
163
|
end
|
|
152
164
|
end
|
|
153
165
|
|
|
166
|
+
# unit tests for delete_attribute_set
|
|
167
|
+
# Allows you to delete an attribute set
|
|
168
|
+
# @param [Hash] opts the optional parameters
|
|
169
|
+
# @option opts [String] :id Default is nil
|
|
170
|
+
# @return [Success]
|
|
171
|
+
describe 'delete_attribute_set test' do
|
|
172
|
+
it 'should work' do
|
|
173
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
154
177
|
# unit tests for delete_payment_term
|
|
155
178
|
# Allows you to delete a payment term
|
|
156
179
|
# @param [Hash] opts the optional parameters
|
|
@@ -213,6 +236,20 @@ describe 'InventoryApi' do
|
|
|
213
236
|
end
|
|
214
237
|
end
|
|
215
238
|
|
|
239
|
+
# unit tests for get_attribute_sets
|
|
240
|
+
# Allows you to retrieve the attribute sets
|
|
241
|
+
# @param [Hash] opts the optional parameters
|
|
242
|
+
# @option opts [String] :page Default is 1
|
|
243
|
+
# @option opts [String] :limit Default is 100
|
|
244
|
+
# @option opts [String] :id Default is nil
|
|
245
|
+
# @option opts [String] :name Default is nil
|
|
246
|
+
# @return [AttributeSets]
|
|
247
|
+
describe 'get_attribute_sets test' do
|
|
248
|
+
it 'should work' do
|
|
249
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
|
|
216
253
|
# unit tests for get_carriers
|
|
217
254
|
# Allows you to retrieve the carriers
|
|
218
255
|
# @param [Hash] opts the optional parameters
|
|
@@ -438,6 +475,18 @@ describe 'InventoryApi' do
|
|
|
438
475
|
end
|
|
439
476
|
end
|
|
440
477
|
|
|
478
|
+
# unit tests for update_attribute_set
|
|
479
|
+
# Allows you to update an attribute set
|
|
480
|
+
# @param attribute_set an attribute set object with properties to update
|
|
481
|
+
# @param [Hash] opts the optional parameters
|
|
482
|
+
# @option opts [Boolean] :summarize_errors If false return 200 OK and mix of successfully created objects and any with validation errors
|
|
483
|
+
# @return [AttributeSet]
|
|
484
|
+
describe 'update_attribute_set test' do
|
|
485
|
+
it 'should work' do
|
|
486
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
487
|
+
end
|
|
488
|
+
end
|
|
489
|
+
|
|
441
490
|
# unit tests for update_customer
|
|
442
491
|
# Allows you to update a customer
|
|
443
492
|
# @param customer a customer object with properties to update
|
|
@@ -0,0 +1,53 @@
|
|
|
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 'spec_helper'
|
|
14
|
+
require 'json'
|
|
15
|
+
require 'date'
|
|
16
|
+
|
|
17
|
+
# Unit tests for DearInventoryRuby::AttributeSetAttribute
|
|
18
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
|
19
|
+
# Please update as you see appropriate
|
|
20
|
+
describe 'AttributeSetAttribute' do
|
|
21
|
+
before do
|
|
22
|
+
# run before each test
|
|
23
|
+
@instance = DearInventoryRuby::AttributeSetAttribute.new
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
after do
|
|
27
|
+
# run after each test
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
describe 'test an instance of AttributeSetAttribute' do
|
|
31
|
+
it 'should create an instance of AttributeSetAttribute' do
|
|
32
|
+
expect(@instance).to be_instance_of(DearInventoryRuby::AttributeSetAttribute)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
describe 'test attribute "name"' do
|
|
36
|
+
it 'should work' do
|
|
37
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
describe 'test attribute "type"' do
|
|
42
|
+
it 'should work' do
|
|
43
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
describe 'test attribute "values"' do
|
|
48
|
+
it 'should work' do
|
|
49
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|