dear-inventory-ruby 0.1.9 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -0
  3. data/README.md +7 -4
  4. data/dear-inventory-ruby.gemspec +1 -1
  5. data/docs/Contact.md +4 -0
  6. data/docs/Customer.md +3 -1
  7. data/docs/InventoryApi.md +54 -0
  8. data/docs/Me.md +1 -1
  9. data/docs/PriceTier.md +19 -0
  10. data/docs/PriceTiers.md +17 -0
  11. data/lib/dear-inventory-ruby.rb +3 -1
  12. data/lib/dear-inventory-ruby/api/inventory_api.rb +55 -1
  13. data/lib/dear-inventory-ruby/api_client.rb +8 -6
  14. data/lib/dear-inventory-ruby/api_error.rb +1 -1
  15. data/lib/dear-inventory-ruby/configuration.rb +1 -1
  16. data/lib/dear-inventory-ruby/models/account.rb +1 -1
  17. data/lib/dear-inventory-ruby/models/accounts.rb +1 -1
  18. data/lib/dear-inventory-ruby/models/address.rb +1 -35
  19. data/lib/dear-inventory-ruby/models/contact.rb +22 -2
  20. data/lib/dear-inventory-ruby/models/currency_code.rb +1 -1
  21. data/lib/dear-inventory-ruby/models/customer.rb +21 -8
  22. data/lib/dear-inventory-ruby/models/customers.rb +1 -1
  23. data/lib/dear-inventory-ruby/models/dimensions_unit.rb +1 -1
  24. data/lib/dear-inventory-ruby/models/error.rb +1 -1
  25. data/lib/dear-inventory-ruby/models/me.rb +3 -2
  26. data/lib/dear-inventory-ruby/models/payment_term.rb +1 -1
  27. data/lib/dear-inventory-ruby/models/payment_terms.rb +1 -1
  28. data/lib/dear-inventory-ruby/models/price_tier.rb +217 -0
  29. data/lib/dear-inventory-ruby/models/price_tiers.rb +209 -0
  30. data/lib/dear-inventory-ruby/models/success.rb +1 -1
  31. data/lib/dear-inventory-ruby/models/tax.rb +1 -1
  32. data/lib/dear-inventory-ruby/models/tax_component.rb +1 -1
  33. data/lib/dear-inventory-ruby/models/taxes.rb +1 -1
  34. data/lib/dear-inventory-ruby/models/weight_unit.rb +1 -1
  35. data/lib/dear-inventory-ruby/version.rb +2 -2
  36. data/spec/.DS_Store +0 -0
  37. data/spec/api/inventory_api_spec.rb +11 -1
  38. data/spec/api_client_spec.rb +1 -1
  39. data/spec/configuration_spec.rb +1 -1
  40. data/spec/models/account_spec.rb +1 -1
  41. data/spec/models/accounts_spec.rb +1 -1
  42. data/spec/models/address_spec.rb +1 -5
  43. data/spec/models/contact_spec.rb +13 -1
  44. data/spec/models/currency_code_spec.rb +1 -1
  45. data/spec/models/customer_spec.rb +7 -1
  46. data/spec/models/customers_spec.rb +1 -1
  47. data/spec/models/dimensions_unit_spec.rb +1 -1
  48. data/spec/models/error_spec.rb +1 -1
  49. data/spec/models/me_spec.rb +1 -1
  50. data/spec/models/payment_term_spec.rb +1 -1
  51. data/spec/models/payment_terms_spec.rb +1 -1
  52. data/spec/models/price_tier_spec.rb +47 -0
  53. data/spec/models/price_tiers_spec.rb +41 -0
  54. data/spec/models/success_spec.rb +1 -1
  55. data/spec/models/tax_component_spec.rb +1 -1
  56. data/spec/models/tax_spec.rb +1 -1
  57. data/spec/models/taxes_spec.rb +1 -1
  58. data/spec/models/weight_unit_spec.rb +1 -1
  59. data/spec/spec_helper.rb +1 -1
  60. metadata +24 -15
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 2.0.0
7
7
  Contact: nnhansg@gmail.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.0
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -20,9 +20,15 @@ module DearInventoryRuby
20
20
  # Name of Contact
21
21
  attr_accessor :name
22
22
 
23
+ # Job Title
24
+ attr_accessor :job_title
25
+
23
26
  # Phone
24
27
  attr_accessor :phone
25
28
 
29
+ # Mobile Phone
30
+ attr_accessor :mobile_phone
31
+
26
32
  # Fax
27
33
  attr_accessor :fax
28
34
 
@@ -46,7 +52,9 @@ module DearInventoryRuby
46
52
  {
47
53
  :'id' => :'ID',
48
54
  :'name' => :'Name',
55
+ :'job_title' => :'JobTitle',
49
56
  :'phone' => :'Phone',
57
+ :'mobile_phone' => :'MobilePhone',
50
58
  :'fax' => :'Fax',
51
59
  :'email' => :'Email',
52
60
  :'website' => :'Website',
@@ -61,7 +69,9 @@ module DearInventoryRuby
61
69
  {
62
70
  :'id' => :'String',
63
71
  :'name' => :'String',
72
+ :'job_title' => :'String',
64
73
  :'phone' => :'String',
74
+ :'mobile_phone' => :'String',
65
75
  :'fax' => :'String',
66
76
  :'email' => :'String',
67
77
  :'website' => :'String',
@@ -100,10 +110,18 @@ module DearInventoryRuby
100
110
  self.name = attributes[:'name']
101
111
  end
102
112
 
113
+ if attributes.key?(:'job_title')
114
+ self.job_title = attributes[:'job_title']
115
+ end
116
+
103
117
  if attributes.key?(:'phone')
104
118
  self.phone = attributes[:'phone']
105
119
  end
106
120
 
121
+ if attributes.key?(:'mobile_phone')
122
+ self.mobile_phone = attributes[:'mobile_phone']
123
+ end
124
+
107
125
  if attributes.key?(:'fax')
108
126
  self.fax = attributes[:'fax']
109
127
  end
@@ -252,7 +270,9 @@ module DearInventoryRuby
252
270
  self.class == o.class &&
253
271
  id == o.id &&
254
272
  name == o.name &&
273
+ job_title == o.job_title &&
255
274
  phone == o.phone &&
275
+ mobile_phone == o.mobile_phone &&
256
276
  fax == o.fax &&
257
277
  email == o.email &&
258
278
  website == o.website &&
@@ -270,7 +290,7 @@ module DearInventoryRuby
270
290
  # Calculates hash code according to all attributes.
271
291
  # @return [Integer] Hash code
272
292
  def hash
273
- [id, name, phone, fax, email, website, comment, default, include_in_email].hash
293
+ [id, name, job_title, phone, mobile_phone, fax, email, website, comment, default, include_in_email].hash
274
294
  end
275
295
 
276
296
  # Builds the object from hash
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 2.0.0
7
7
  Contact: nnhansg@gmail.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.0
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 2.0.0
7
7
  Contact: nnhansg@gmail.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.0
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -23,6 +23,7 @@ module DearInventoryRuby
23
23
  # Points that Customer is Active. Available values are Active and Deprecated. Required for POST
24
24
  attr_accessor :status
25
25
 
26
+ # Currency code of Customer
26
27
  attr_accessor :currency
27
28
 
28
29
  # Payment term
@@ -61,6 +62,9 @@ module DearInventoryRuby
61
62
  # Credit limit
62
63
  attr_accessor :credit_limit
63
64
 
65
+ # boolean to indicate if a customer is on credit hold
66
+ attr_accessor :is_on_credit_hold
67
+
64
68
  # Tags string
65
69
  attr_accessor :tags
66
70
 
@@ -147,6 +151,7 @@ module DearInventoryRuby
147
151
  :'comments' => :'Comments',
148
152
  :'tax_number' => :'TaxNumber',
149
153
  :'credit_limit' => :'CreditLimit',
154
+ :'is_on_credit_hold' => :'IsOnCreditHold',
150
155
  :'tags' => :'Tags',
151
156
  :'attribute_set' => :'AttributeSet',
152
157
  :'additional_attribute1' => :'AdditionalAttribute1',
@@ -171,7 +176,7 @@ module DearInventoryRuby
171
176
  :'id' => :'String',
172
177
  :'name' => :'String',
173
178
  :'status' => :'String',
174
- :'currency' => :'CurrencyCode',
179
+ :'currency' => :'String',
175
180
  :'payment_term' => :'String',
176
181
  :'account_receivable' => :'String',
177
182
  :'revenue_account' => :'String',
@@ -184,6 +189,7 @@ module DearInventoryRuby
184
189
  :'comments' => :'String',
185
190
  :'tax_number' => :'String',
186
191
  :'credit_limit' => :'Float',
192
+ :'is_on_credit_hold' => :'Boolean',
187
193
  :'tags' => :'String',
188
194
  :'attribute_set' => :'String',
189
195
  :'additional_attribute1' => :'String',
@@ -287,6 +293,12 @@ module DearInventoryRuby
287
293
  self.credit_limit = attributes[:'credit_limit']
288
294
  end
289
295
 
296
+ if attributes.key?(:'is_on_credit_hold')
297
+ self.is_on_credit_hold = attributes[:'is_on_credit_hold']
298
+ else
299
+ self.is_on_credit_hold = false
300
+ end
301
+
290
302
  if attributes.key?(:'tags')
291
303
  self.tags = attributes[:'tags']
292
304
  end
@@ -388,8 +400,8 @@ module DearInventoryRuby
388
400
  invalid_properties.push('invalid value for "tax_rule", tax_rule cannot be nil.')
389
401
  end
390
402
 
391
- if !@comments.nil? && @comments.to_s.length > 256
392
- invalid_properties.push('invalid value for "comments", the character length must be smaller than or equal to 256.')
403
+ if !@comments.nil? && @comments.to_s.length > 2000
404
+ invalid_properties.push('invalid value for "comments", the character length must be smaller than or equal to 2000.')
393
405
  end
394
406
 
395
407
  invalid_properties
@@ -408,7 +420,7 @@ module DearInventoryRuby
408
420
  return false if @account_receivable.nil?
409
421
  return false if @revenue_account.nil?
410
422
  return false if @tax_rule.nil?
411
- return false if !@comments.nil? && @comments.to_s.length > 256
423
+ return false if !@comments.nil? && @comments.to_s.length > 2000
412
424
  true
413
425
  end
414
426
 
@@ -439,8 +451,8 @@ module DearInventoryRuby
439
451
  # Custom attribute writer method with validation
440
452
  # @param [Object] comments Value to be assigned
441
453
  def comments=(comments)
442
- if !comments.nil? && comments.to_s.length > 256
443
- fail ArgumentError, 'invalid value for "comments", the character length must be smaller than or equal to 256.'
454
+ if !comments.nil? && comments.to_s.length > 2000
455
+ fail ArgumentError, 'invalid value for "comments", the character length must be smaller than or equal to 2000.'
444
456
  end
445
457
 
446
458
  @comments = comments
@@ -467,6 +479,7 @@ module DearInventoryRuby
467
479
  comments == o.comments &&
468
480
  tax_number == o.tax_number &&
469
481
  credit_limit == o.credit_limit &&
482
+ is_on_credit_hold == o.is_on_credit_hold &&
470
483
  tags == o.tags &&
471
484
  attribute_set == o.attribute_set &&
472
485
  additional_attribute1 == o.additional_attribute1 &&
@@ -493,7 +506,7 @@ module DearInventoryRuby
493
506
  # Calculates hash code according to all attributes.
494
507
  # @return [Integer] Hash code
495
508
  def hash
496
- [id, name, status, currency, payment_term, account_receivable, revenue_account, tax_rule, price_tier, carrier, sales_representative, location, discount, comments, tax_number, credit_limit, tags, attribute_set, additional_attribute1, additional_attribute2, additional_attribute3, additional_attribute4, additional_attribute5, additional_attribute6, additional_attribute7, additional_attribute8, additional_attribute9, additional_attribute10, last_modified_on, addresses, contacts].hash
509
+ [id, name, status, currency, payment_term, account_receivable, revenue_account, tax_rule, price_tier, carrier, sales_representative, location, discount, comments, tax_number, credit_limit, is_on_credit_hold, tags, attribute_set, additional_attribute1, additional_attribute2, additional_attribute3, additional_attribute4, additional_attribute5, additional_attribute6, additional_attribute7, additional_attribute8, additional_attribute9, additional_attribute10, last_modified_on, addresses, contacts].hash
497
510
  end
498
511
 
499
512
  # Builds the object from hash
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 2.0.0
7
7
  Contact: nnhansg@gmail.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.0
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 2.0.0
7
7
  Contact: nnhansg@gmail.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.0
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 2.0.0
7
7
  Contact: nnhansg@gmail.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.0
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 2.0.0
7
7
  Contact: nnhansg@gmail.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.0
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -17,6 +17,7 @@ module DearInventoryRuby
17
17
  # Your company name
18
18
  attr_accessor :company
19
19
 
20
+ # Your company base currency
20
21
  attr_accessor :currency
21
22
 
22
23
  # Time Zone where your company located
@@ -49,7 +50,7 @@ module DearInventoryRuby
49
50
  def self.openapi_types
50
51
  {
51
52
  :'company' => :'String',
52
- :'currency' => :'CurrencyCode',
53
+ :'currency' => :'String',
53
54
  :'time_zone' => :'String',
54
55
  :'default_weight_units' => :'WeightUnit',
55
56
  :'default_dimensions_units' => :'DimensionsUnit',
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 2.0.0
7
7
  Contact: nnhansg@gmail.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.0
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -6,7 +6,7 @@
6
6
  The version of the OpenAPI document: 2.0.0
7
7
  Contact: nnhansg@gmail.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 4.3.0
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
@@ -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 PriceTier
17
+ # Code number of Price Tier
18
+ attr_accessor :code
19
+
20
+ # Price Tier name
21
+ attr_accessor :name
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'code' => :'Code',
27
+ :'name' => :'Name'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'code' => :'Integer',
35
+ :'name' => :'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::PriceTier` 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::PriceTier`. 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?(:'code')
61
+ self.code = attributes[:'code']
62
+ end
63
+
64
+ if attributes.key?(:'name')
65
+ self.name = attributes[:'name']
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
+ code == o.code &&
88
+ name == o.name
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
+ [code, name].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