dear-inventory-ruby 0.1.11 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 243e64402774069043900856b225948134147830e263704463585b194b3ed89b
4
- data.tar.gz: 24f844feb4bc3e8faa91efeba7d739a547fad67cd3806808554b3559ec0f8a8e
3
+ metadata.gz: a7798e799cbf4fa681aad8ee42427c13fb6da8fd45e72b6c6feeb69af8ba371f
4
+ data.tar.gz: 2121bc741a44a0af49b783443b0e554fcb140461c615e74fd59918b14dc3d5b8
5
5
  SHA512:
6
- metadata.gz: eae064c9779db74edf93facc05b24c9b95a4886aae40172e4b33466431163f199cc2f377ffdbe29087137c335fc2124e7cbc1fd4a870f1c4b6c844aefeb9158c
7
- data.tar.gz: 6242834e8f61630d0afdcb0ffea31cfed05bccdce6875e103a140510e5d1826ed2c4c5e4e3d2d0d0a8e2cfd3503b522095bb35f3aa63a3a3140712376936c1ee
6
+ metadata.gz: e7a495a34bf3bfaec919ce61024002f81ab698dd085b4104a4454db4366f1dd9d3ff9c0bfc5de35e6613337fd93fe8ff4db0c61d814e6fa121c10c2548e0e94f
7
+ data.tar.gz: 67eb1ebfda865b6888d4e4737705cc27641d571e50d39ec5e48ee323c6cb4bb4bb8b236654335db827c2ed9e25ffb92fe38b047d0aec5aa6d8c316338ec29204
@@ -2,6 +2,11 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.1.12] - 2020-10-28
6
+
7
+ - Add new endpoint and model: PriceTier
8
+ - Endpoint GET PriceTiers
9
+
5
10
  ## [0.1.11] - 2020-09-21
6
11
 
7
12
  - Update limit of Comments in Customer model.
data/README.md CHANGED
@@ -7,7 +7,7 @@ This specifing endpoints for DEAR Inventory API
7
7
  This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
8
8
 
9
9
  - API version: 2.0.0
10
- - Package version: 0.1.11
10
+ - Package version: 0.1.12
11
11
  - Build package: org.openapitools.codegen.languages.RubyClientCodegen
12
12
  For more information, please visit [https://www.nnhan.me](https://www.nnhan.me)
13
13
 
@@ -24,16 +24,16 @@ gem build dear-inventory-ruby.gemspec
24
24
  Then either install the gem locally:
25
25
 
26
26
  ```shell
27
- gem install ./dear-inventory-ruby-0.1.11.gem
27
+ gem install ./dear-inventory-ruby-0.1.12.gem
28
28
  ```
29
29
 
30
- (for development, run `gem install --dev ./dear-inventory-ruby-0.1.11.gem` to install the development dependencies)
30
+ (for development, run `gem install --dev ./dear-inventory-ruby-0.1.12.gem` to install the development dependencies)
31
31
 
32
32
  or publish the gem to a gem hosting service, e.g. [RubyGems](https://rubygems.org/).
33
33
 
34
34
  Finally add this to the Gemfile:
35
35
 
36
- gem 'dear-inventory-ruby', '~> 0.1.11'
36
+ gem 'dear-inventory-ruby', '~> 0.1.12'
37
37
 
38
38
  ### Install from Git
39
39
 
@@ -102,6 +102,7 @@ Class | Method | HTTP request | Description
102
102
  *DearInventoryRuby::InventoryApi* | [**get_customers**](docs/InventoryApi.md#get_customers) | **GET** /customer | Allows you to retrieve the customers
103
103
  *DearInventoryRuby::InventoryApi* | [**get_me**](docs/InventoryApi.md#get_me) | **GET** /me | Allows you to retrieve your information
104
104
  *DearInventoryRuby::InventoryApi* | [**get_payment_terms**](docs/InventoryApi.md#get_payment_terms) | **GET** /ref/paymentterm | Allows you to retrieve the payment terms
105
+ *DearInventoryRuby::InventoryApi* | [**get_price_tiers**](docs/InventoryApi.md#get_price_tiers) | **GET** /ref/priceTier | Allows you to retrieve the Price Tiers
105
106
  *DearInventoryRuby::InventoryApi* | [**get_taxes**](docs/InventoryApi.md#get_taxes) | **GET** /ref/tax | Allows you to retrieve the taxes
106
107
  *DearInventoryRuby::InventoryApi* | [**update_account**](docs/InventoryApi.md#update_account) | **PUT** /ref/account | Allows you to update an Account
107
108
  *DearInventoryRuby::InventoryApi* | [**update_customer**](docs/InventoryApi.md#update_customer) | **PUT** /customer | Allows you to update a customer
@@ -123,6 +124,8 @@ Class | Method | HTTP request | Description
123
124
  - [DearInventoryRuby::Me](docs/Me.md)
124
125
  - [DearInventoryRuby::PaymentTerm](docs/PaymentTerm.md)
125
126
  - [DearInventoryRuby::PaymentTerms](docs/PaymentTerms.md)
127
+ - [DearInventoryRuby::PriceTier](docs/PriceTier.md)
128
+ - [DearInventoryRuby::PriceTiers](docs/PriceTiers.md)
126
129
  - [DearInventoryRuby::Success](docs/Success.md)
127
130
  - [DearInventoryRuby::Tax](docs/Tax.md)
128
131
  - [DearInventoryRuby::TaxComponent](docs/TaxComponent.md)
@@ -14,6 +14,7 @@ Method | HTTP request | Description
14
14
  [**get_customers**](InventoryApi.md#get_customers) | **GET** /customer | Allows you to retrieve the customers
15
15
  [**get_me**](InventoryApi.md#get_me) | **GET** /me | Allows you to retrieve your information
16
16
  [**get_payment_terms**](InventoryApi.md#get_payment_terms) | **GET** /ref/paymentterm | Allows you to retrieve the payment terms
17
+ [**get_price_tiers**](InventoryApi.md#get_price_tiers) | **GET** /ref/priceTier | Allows you to retrieve the Price Tiers
17
18
  [**get_taxes**](InventoryApi.md#get_taxes) | **GET** /ref/tax | Allows you to retrieve the taxes
18
19
  [**update_account**](InventoryApi.md#update_account) | **PUT** /ref/account | Allows you to update an Account
19
20
  [**update_customer**](InventoryApi.md#update_customer) | **PUT** /customer | Allows you to update a customer
@@ -646,6 +647,59 @@ Name | Type | Description | Notes
646
647
  - **Accept**: application/json
647
648
 
648
649
 
650
+ ## get_price_tiers
651
+
652
+ > PriceTiers get_price_tiers
653
+
654
+ Allows you to retrieve the Price Tiers
655
+
656
+ ### Example
657
+
658
+ ```ruby
659
+ # load the gem
660
+ require 'dear-inventory-ruby'
661
+ # setup authorization
662
+ DearInventoryRuby.configure do |config|
663
+ # Configure API key authorization: accountID
664
+ config.api_key['api-auth-accountid'] = 'YOUR API KEY'
665
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
666
+ #config.api_key_prefix['api-auth-accountid'] = 'Bearer'
667
+
668
+ # Configure API key authorization: appKey
669
+ config.api_key['api-auth-applicationkey'] = 'YOUR API KEY'
670
+ # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
671
+ #config.api_key_prefix['api-auth-applicationkey'] = 'Bearer'
672
+ end
673
+
674
+ api_instance = DearInventoryRuby::InventoryApi.new
675
+
676
+ begin
677
+ #Allows you to retrieve the Price Tiers
678
+ result = api_instance.get_price_tiers
679
+ p result
680
+ rescue DearInventoryRuby::ApiError => e
681
+ puts "Exception when calling InventoryApi->get_price_tiers: #{e}"
682
+ end
683
+ ```
684
+
685
+ ### Parameters
686
+
687
+ This endpoint does not need any parameter.
688
+
689
+ ### Return type
690
+
691
+ [**PriceTiers**](PriceTiers.md)
692
+
693
+ ### Authorization
694
+
695
+ [accountID](../README.md#accountID), [appKey](../README.md#appKey)
696
+
697
+ ### HTTP request headers
698
+
699
+ - **Content-Type**: Not defined
700
+ - **Accept**: application/json
701
+
702
+
649
703
  ## get_taxes
650
704
 
651
705
  > Taxes get_taxes(opts)
@@ -0,0 +1,19 @@
1
+ # DearInventoryRuby::PriceTier
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **code** | **Integer** | Code number of Price Tier | [optional]
8
+ **name** | **String** | Price Tier name | [optional]
9
+
10
+ ## Code Sample
11
+
12
+ ```ruby
13
+ require 'DearInventoryRuby'
14
+
15
+ instance = DearInventoryRuby::PriceTier.new(code: nil,
16
+ name: nil)
17
+ ```
18
+
19
+
@@ -0,0 +1,17 @@
1
+ # DearInventoryRuby::PriceTiers
2
+
3
+ ## Properties
4
+
5
+ Name | Type | Description | Notes
6
+ ------------ | ------------- | ------------- | -------------
7
+ **price_tiers_list** | [**Array<PriceTier>**](PriceTier.md) | Array of PriceTiers | [optional]
8
+
9
+ ## Code Sample
10
+
11
+ ```ruby
12
+ require 'DearInventoryRuby'
13
+
14
+ instance = DearInventoryRuby::PriceTiers.new(price_tiers_list: nil)
15
+ ```
16
+
17
+
@@ -29,6 +29,8 @@ require 'dear-inventory-ruby/models/error'
29
29
  require 'dear-inventory-ruby/models/me'
30
30
  require 'dear-inventory-ruby/models/payment_term'
31
31
  require 'dear-inventory-ruby/models/payment_terms'
32
+ require 'dear-inventory-ruby/models/price_tier'
33
+ require 'dear-inventory-ruby/models/price_tiers'
32
34
  require 'dear-inventory-ruby/models/success'
33
35
  require 'dear-inventory-ruby/models/tax'
34
36
  require 'dear-inventory-ruby/models/tax_component'
@@ -666,6 +666,60 @@ module DearInventoryRuby
666
666
  return data, status_code, headers
667
667
  end
668
668
 
669
+ # Allows you to retrieve the Price Tiers
670
+ # @param [Hash] opts the optional parameters
671
+ # @return [PriceTiers]
672
+ def get_price_tiers(opts = {})
673
+ data, _status_code, _headers = get_price_tiers_with_http_info(opts)
674
+ data
675
+ end
676
+
677
+ # Allows you to retrieve the Price Tiers
678
+ # @param [Hash] opts the optional parameters
679
+ # @return [Array<(PriceTiers, Integer, Hash)>] PriceTiers data, response status code and response headers
680
+ def get_price_tiers_with_http_info(opts = {})
681
+ if @api_client.config.debugging
682
+ @api_client.config.logger.debug 'Calling API: InventoryApi.get_price_tiers ...'
683
+ end
684
+ # resource path
685
+ local_var_path = '/ref/priceTier'
686
+
687
+ # query parameters
688
+ query_params = opts[:query_params] || {}
689
+
690
+ # header parameters
691
+ header_params = opts[:header_params] || {}
692
+ # HTTP header 'Accept' (if needed)
693
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
694
+
695
+ # form parameters
696
+ form_params = opts[:form_params] || {}
697
+
698
+ # http body (model)
699
+ post_body = opts[:body]
700
+
701
+ # return_type
702
+ return_type = opts[:return_type] || 'PriceTiers'
703
+
704
+ # auth_names
705
+ auth_names = opts[:auth_names] || ['accountID', 'appKey']
706
+
707
+ new_options = opts.merge(
708
+ :header_params => header_params,
709
+ :query_params => query_params,
710
+ :form_params => form_params,
711
+ :body => post_body,
712
+ :auth_names => auth_names,
713
+ :return_type => return_type
714
+ )
715
+
716
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
717
+ if @api_client.config.debugging
718
+ @api_client.config.logger.debug "API called: InventoryApi#get_price_tiers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
719
+ end
720
+ return data, status_code, headers
721
+ end
722
+
669
723
  # Allows you to retrieve the taxes
670
724
  # @param [Hash] opts the optional parameters
671
725
  # @option opts [String] :page Default is 1 (default to '1')
@@ -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
@@ -0,0 +1,209 @@
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 PriceTiers
17
+ # Array of PriceTiers
18
+ attr_accessor :price_tiers_list
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'price_tiers_list' => :'PriceTiersList'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'price_tiers_list' => :'Array<PriceTier>'
31
+ }
32
+ end
33
+
34
+ # List of attributes with nullable: true
35
+ def self.openapi_nullable
36
+ Set.new([
37
+ ])
38
+ end
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ def initialize(attributes = {})
43
+ if (!attributes.is_a?(Hash))
44
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DearInventoryRuby::PriceTiers` initialize method"
45
+ end
46
+
47
+ # check to see if the attribute exists and convert string to symbol for hash key
48
+ attributes = attributes.each_with_object({}) { |(k, v), h|
49
+ if (!self.class.attribute_map.key?(k.to_sym))
50
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DearInventoryRuby::PriceTiers`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
51
+ end
52
+ h[k.to_sym] = v
53
+ }
54
+
55
+ if attributes.key?(:'price_tiers_list')
56
+ if (value = attributes[:'price_tiers_list']).is_a?(Array)
57
+ self.price_tiers_list = value
58
+ end
59
+ end
60
+ end
61
+
62
+ # Show invalid properties with the reasons. Usually used together with valid?
63
+ # @return Array for valid properties with the reasons
64
+ def list_invalid_properties
65
+ invalid_properties = Array.new
66
+ invalid_properties
67
+ end
68
+
69
+ # Check to see if the all the properties in the model are valid
70
+ # @return true if the model is valid
71
+ def valid?
72
+ true
73
+ end
74
+
75
+ # Checks equality by comparing each attribute.
76
+ # @param [Object] Object to be compared
77
+ def ==(o)
78
+ return true if self.equal?(o)
79
+ self.class == o.class &&
80
+ price_tiers_list == o.price_tiers_list
81
+ end
82
+
83
+ # @see the `==` method
84
+ # @param [Object] Object to be compared
85
+ def eql?(o)
86
+ self == o
87
+ end
88
+
89
+ # Calculates hash code according to all attributes.
90
+ # @return [Integer] Hash code
91
+ def hash
92
+ [price_tiers_list].hash
93
+ end
94
+
95
+ # Builds the object from hash
96
+ # @param [Hash] attributes Model attributes in the form of hash
97
+ # @return [Object] Returns the model itself
98
+ def self.build_from_hash(attributes)
99
+ new.build_from_hash(attributes)
100
+ end
101
+
102
+ # Builds the object from hash
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ # @return [Object] Returns the model itself
105
+ def build_from_hash(attributes)
106
+ return nil unless attributes.is_a?(Hash)
107
+ self.class.openapi_types.each_pair do |key, type|
108
+ if type =~ /\AArray<(.*)>/i
109
+ # check to ensure the input is an array given that the attribute
110
+ # is documented as an array but the input is not
111
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
112
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
113
+ end
114
+ elsif !attributes[self.class.attribute_map[key]].nil?
115
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
116
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
117
+ end
118
+
119
+ self
120
+ end
121
+
122
+ # Deserializes the data based on type
123
+ # @param string type Data type
124
+ # @param string value Value to be deserialized
125
+ # @return [Object] Deserialized data
126
+ def _deserialize(type, value)
127
+ case type.to_sym
128
+ when :DateTime
129
+ DateTime.parse(value)
130
+ when :Date
131
+ Date.parse(value)
132
+ when :String
133
+ value.to_s
134
+ when :Integer
135
+ value.to_i
136
+ when :Float
137
+ value.to_f
138
+ when :Boolean
139
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
140
+ true
141
+ else
142
+ false
143
+ end
144
+ when :Object
145
+ # generic object (usually a Hash), return directly
146
+ value
147
+ when /\AArray<(?<inner_type>.+)>\z/
148
+ inner_type = Regexp.last_match[:inner_type]
149
+ value.map { |v| _deserialize(inner_type, v) }
150
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
151
+ k_type = Regexp.last_match[:k_type]
152
+ v_type = Regexp.last_match[:v_type]
153
+ {}.tap do |hash|
154
+ value.each do |k, v|
155
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
156
+ end
157
+ end
158
+ else # model
159
+ DearInventoryRuby.const_get(type).build_from_hash(value)
160
+ end
161
+ end
162
+
163
+ # Returns the string representation of the object
164
+ # @return [String] String presentation of the object
165
+ def to_s
166
+ to_hash.to_s
167
+ end
168
+
169
+ # to_body is an alias to to_hash (backward compatibility)
170
+ # @return [Hash] Returns the object in the form of hash
171
+ def to_body
172
+ to_hash
173
+ end
174
+
175
+ # Returns the object in the form of hash
176
+ # @return [Hash] Returns the object in the form of hash
177
+ def to_hash
178
+ hash = {}
179
+ self.class.attribute_map.each_pair do |attr, param|
180
+ value = self.send(attr)
181
+ if value.nil?
182
+ is_nullable = self.class.openapi_nullable.include?(attr)
183
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
184
+ end
185
+
186
+ hash[param] = _to_hash(value)
187
+ end
188
+ hash
189
+ end
190
+
191
+ # Outputs non-array value in the form of hash
192
+ # For object, use to_hash. Otherwise, just return the value
193
+ # @param [Object] value Any valid value
194
+ # @return [Hash] Returns the value in the form of hash
195
+ def _to_hash(value)
196
+ if value.is_a?(Array)
197
+ value.compact.map { |v| _to_hash(v) }
198
+ elsif value.is_a?(Hash)
199
+ {}.tap do |hash|
200
+ value.each { |k, v| hash[k] = _to_hash(v) }
201
+ end
202
+ elsif value.respond_to? :to_hash
203
+ value.to_hash
204
+ else
205
+ value
206
+ end
207
+ end
208
+ end
209
+ end
@@ -11,5 +11,5 @@ OpenAPI Generator version: 4.3.1
11
11
  =end
12
12
 
13
13
  module DearInventoryRuby
14
- VERSION = '0.1.11'
14
+ VERSION = '0.1.12'
15
15
  end
@@ -161,6 +161,16 @@ describe 'InventoryApi' do
161
161
  end
162
162
  end
163
163
 
164
+ # unit tests for get_price_tiers
165
+ # Allows you to retrieve the Price Tiers
166
+ # @param [Hash] opts the optional parameters
167
+ # @return [PriceTiers]
168
+ describe 'get_price_tiers test' do
169
+ it 'should work' do
170
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
171
+ end
172
+ end
173
+
164
174
  # unit tests for get_taxes
165
175
  # Allows you to retrieve the taxes
166
176
  # @param [Hash] opts the optional parameters
@@ -0,0 +1,47 @@
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::PriceTier
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe 'PriceTier' do
21
+ before do
22
+ # run before each test
23
+ @instance = DearInventoryRuby::PriceTier.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of PriceTier' do
31
+ it 'should create an instance of PriceTier' do
32
+ expect(@instance).to be_instance_of(DearInventoryRuby::PriceTier)
33
+ end
34
+ end
35
+ describe 'test attribute "code"' 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 "name"' 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
+ end
@@ -0,0 +1,41 @@
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::PriceTiers
18
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
19
+ # Please update as you see appropriate
20
+ describe 'PriceTiers' do
21
+ before do
22
+ # run before each test
23
+ @instance = DearInventoryRuby::PriceTiers.new
24
+ end
25
+
26
+ after do
27
+ # run after each test
28
+ end
29
+
30
+ describe 'test an instance of PriceTiers' do
31
+ it 'should create an instance of PriceTiers' do
32
+ expect(@instance).to be_instance_of(DearInventoryRuby::PriceTiers)
33
+ end
34
+ end
35
+ describe 'test attribute "price_tiers_list"' 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
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dear-inventory-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nhan Nguyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-21 00:00:00.000000000 Z
11
+ date: 2020-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -91,6 +91,8 @@ files:
91
91
  - docs/Me.md
92
92
  - docs/PaymentTerm.md
93
93
  - docs/PaymentTerms.md
94
+ - docs/PriceTier.md
95
+ - docs/PriceTiers.md
94
96
  - docs/Success.md
95
97
  - docs/Tax.md
96
98
  - docs/TaxComponent.md
@@ -114,6 +116,8 @@ files:
114
116
  - lib/dear-inventory-ruby/models/me.rb
115
117
  - lib/dear-inventory-ruby/models/payment_term.rb
116
118
  - lib/dear-inventory-ruby/models/payment_terms.rb
119
+ - lib/dear-inventory-ruby/models/price_tier.rb
120
+ - lib/dear-inventory-ruby/models/price_tiers.rb
117
121
  - lib/dear-inventory-ruby/models/success.rb
118
122
  - lib/dear-inventory-ruby/models/tax.rb
119
123
  - lib/dear-inventory-ruby/models/tax_component.rb
@@ -135,6 +139,8 @@ files:
135
139
  - spec/models/me_spec.rb
136
140
  - spec/models/payment_term_spec.rb
137
141
  - spec/models/payment_terms_spec.rb
142
+ - spec/models/price_tier_spec.rb
143
+ - spec/models/price_tiers_spec.rb
138
144
  - spec/models/success_spec.rb
139
145
  - spec/models/tax_component_spec.rb
140
146
  - spec/models/tax_spec.rb
@@ -187,6 +193,8 @@ test_files:
187
193
  - spec/models/accounts_spec.rb
188
194
  - spec/models/me_spec.rb
189
195
  - spec/models/success_spec.rb
196
+ - spec/models/price_tier_spec.rb
190
197
  - spec/models/weight_unit_spec.rb
191
198
  - spec/models/address_spec.rb
199
+ - spec/models/price_tiers_spec.rb
192
200
  - spec/spec_helper.rb