dear-inventory-ruby 0.2.9 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -0
  3. data/README.md +14 -4
  4. data/docs/Bin.md +19 -0
  5. data/docs/Carrier.md +19 -0
  6. data/docs/Carriers.md +21 -0
  7. data/docs/InventoryApi.md +192 -4
  8. data/docs/Location.md +51 -0
  9. data/docs/Locations.md +21 -0
  10. data/docs/MeContact.md +33 -0
  11. data/docs/MeContacts.md +21 -0
  12. data/lib/dear-inventory-ruby/api/inventory_api.rb +193 -4
  13. data/lib/dear-inventory-ruby/models/account.rb +0 -76
  14. data/lib/dear-inventory-ruby/models/bin.rb +217 -0
  15. data/lib/dear-inventory-ruby/models/carrier.rb +217 -0
  16. data/lib/dear-inventory-ruby/models/carriers.rb +229 -0
  17. data/lib/dear-inventory-ruby/models/contact.rb +0 -94
  18. data/lib/dear-inventory-ruby/models/customer.rb +0 -34
  19. data/lib/dear-inventory-ruby/models/location.rb +391 -0
  20. data/lib/dear-inventory-ruby/models/locations.rb +229 -0
  21. data/lib/dear-inventory-ruby/models/me_contact.rb +289 -0
  22. data/lib/dear-inventory-ruby/models/me_contacts.rb +229 -0
  23. data/lib/dear-inventory-ruby/models/payment_term.rb +0 -19
  24. data/lib/dear-inventory-ruby/models/supplier_customer_address.rb +0 -75
  25. data/lib/dear-inventory-ruby/models/tax_component.rb +0 -19
  26. data/lib/dear-inventory-ruby/version.rb +1 -1
  27. data/lib/dear-inventory-ruby.rb +7 -0
  28. data/spec/.DS_Store +0 -0
  29. data/spec/api/inventory_api_spec.rb +41 -2
  30. data/spec/models/bin_spec.rb +47 -0
  31. data/spec/models/carrier_spec.rb +47 -0
  32. data/spec/models/carriers_spec.rb +53 -0
  33. data/spec/models/location_spec.rb +143 -0
  34. data/spec/models/locations_spec.rb +53 -0
  35. data/spec/models/me_contact_spec.rb +89 -0
  36. data/spec/models/me_contacts_spec.rb +53 -0
  37. metadata +30 -2
@@ -967,6 +967,72 @@ module DearInventoryRuby
967
967
  return data, status_code, headers
968
968
  end
969
969
 
970
+ # Allows you to retrieve the carriers
971
+ # @param [Hash] opts the optional parameters
972
+ # @option opts [String] :page Default is 1 (default to '1')
973
+ # @option opts [String] :limit Default is 100 (default to '100')
974
+ # @option opts [String] :carrier_id Only return Carrier with the specific CarrierID
975
+ # @option opts [String] :description Only return Carriers that start with the specific Description
976
+ # @return [Carriers]
977
+ def get_carriers(opts = {})
978
+ data, _status_code, _headers = get_carriers_with_http_info(opts)
979
+ data
980
+ end
981
+
982
+ # Allows you to retrieve the carriers
983
+ # @param [Hash] opts the optional parameters
984
+ # @option opts [String] :page Default is 1
985
+ # @option opts [String] :limit Default is 100
986
+ # @option opts [String] :carrier_id Only return Carrier with the specific CarrierID
987
+ # @option opts [String] :description Only return Carriers that start with the specific Description
988
+ # @return [Array<(Carriers, Integer, Hash)>] Carriers data, response status code and response headers
989
+ def get_carriers_with_http_info(opts = {})
990
+ if @api_client.config.debugging
991
+ @api_client.config.logger.debug 'Calling API: InventoryApi.get_carriers ...'
992
+ end
993
+ # resource path
994
+ local_var_path = '/ref/carrier'
995
+
996
+ # query parameters
997
+ query_params = opts[:query_params] || {}
998
+ query_params[:'Page'] = opts[:'page'] if !opts[:'page'].nil?
999
+ query_params[:'Limit'] = opts[:'limit'] if !opts[:'limit'].nil?
1000
+ query_params[:'CarrierID'] = opts[:'carrier_id'] if !opts[:'carrier_id'].nil?
1001
+ query_params[:'Description'] = opts[:'description'] if !opts[:'description'].nil?
1002
+
1003
+ # header parameters
1004
+ header_params = opts[:header_params] || {}
1005
+ # HTTP header 'Accept' (if needed)
1006
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1007
+
1008
+ # form parameters
1009
+ form_params = opts[:form_params] || {}
1010
+
1011
+ # http body (model)
1012
+ post_body = opts[:body]
1013
+
1014
+ # return_type
1015
+ return_type = opts[:return_type] || 'Carriers'
1016
+
1017
+ # auth_names
1018
+ auth_names = opts[:auth_names] || ['accountID', 'appKey']
1019
+
1020
+ new_options = opts.merge(
1021
+ :header_params => header_params,
1022
+ :query_params => query_params,
1023
+ :form_params => form_params,
1024
+ :body => post_body,
1025
+ :auth_names => auth_names,
1026
+ :return_type => return_type
1027
+ )
1028
+
1029
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1030
+ if @api_client.config.debugging
1031
+ @api_client.config.logger.debug "API called: InventoryApi#get_carriers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1032
+ end
1033
+ return data, status_code, headers
1034
+ end
1035
+
970
1036
  # Allows you to retrieve the customers
971
1037
  # @param [Hash] opts the optional parameters
972
1038
  # @option opts [String] :page Default is 1 (default to '1')
@@ -975,8 +1041,8 @@ module DearInventoryRuby
975
1041
  # @option opts [String] :name Default is nil
976
1042
  # @option opts [String] :contact_filter Default is nil
977
1043
  # @option opts [String] :modified_since Default is nil
978
- # @option opts [String] :include_deprecated Default is false (default to 'false')
979
- # @option opts [String] :include_product_prices Default is false (default to 'false')
1044
+ # @option opts [Boolean] :include_deprecated Default is false (default to false)
1045
+ # @option opts [Boolean] :include_product_prices Default is false (default to false)
980
1046
  # @return [Customers]
981
1047
  def get_customers(opts = {})
982
1048
  data, _status_code, _headers = get_customers_with_http_info(opts)
@@ -991,8 +1057,8 @@ module DearInventoryRuby
991
1057
  # @option opts [String] :name Default is nil
992
1058
  # @option opts [String] :contact_filter Default is nil
993
1059
  # @option opts [String] :modified_since Default is nil
994
- # @option opts [String] :include_deprecated Default is false
995
- # @option opts [String] :include_product_prices Default is false
1060
+ # @option opts [Boolean] :include_deprecated Default is false
1061
+ # @option opts [Boolean] :include_product_prices Default is false
996
1062
  # @return [Array<(Customers, Integer, Hash)>] Customers data, response status code and response headers
997
1063
  def get_customers_with_http_info(opts = {})
998
1064
  if @api_client.config.debugging
@@ -1045,6 +1111,75 @@ module DearInventoryRuby
1045
1111
  return data, status_code, headers
1046
1112
  end
1047
1113
 
1114
+ # Allows you to retrieve the locations
1115
+ # @param [Hash] opts the optional parameters
1116
+ # @option opts [String] :page Default is 1 (default to '1')
1117
+ # @option opts [String] :limit Default is 100 (default to '100')
1118
+ # @option opts [String] :id Default is nil
1119
+ # @option opts [Boolean] :deprecated Default is false (default to false)
1120
+ # @option opts [String] :name Default is nil
1121
+ # @return [Locations]
1122
+ def get_locations(opts = {})
1123
+ data, _status_code, _headers = get_locations_with_http_info(opts)
1124
+ data
1125
+ end
1126
+
1127
+ # Allows you to retrieve the locations
1128
+ # @param [Hash] opts the optional parameters
1129
+ # @option opts [String] :page Default is 1
1130
+ # @option opts [String] :limit Default is 100
1131
+ # @option opts [String] :id Default is nil
1132
+ # @option opts [Boolean] :deprecated Default is false
1133
+ # @option opts [String] :name Default is nil
1134
+ # @return [Array<(Locations, Integer, Hash)>] Locations data, response status code and response headers
1135
+ def get_locations_with_http_info(opts = {})
1136
+ if @api_client.config.debugging
1137
+ @api_client.config.logger.debug 'Calling API: InventoryApi.get_locations ...'
1138
+ end
1139
+ # resource path
1140
+ local_var_path = '/ref/location'
1141
+
1142
+ # query parameters
1143
+ query_params = opts[:query_params] || {}
1144
+ query_params[:'Page'] = opts[:'page'] if !opts[:'page'].nil?
1145
+ query_params[:'Limit'] = opts[:'limit'] if !opts[:'limit'].nil?
1146
+ query_params[:'ID'] = opts[:'id'] if !opts[:'id'].nil?
1147
+ query_params[:'Deprecated'] = opts[:'deprecated'] if !opts[:'deprecated'].nil?
1148
+ query_params[:'Name'] = opts[:'name'] if !opts[:'name'].nil?
1149
+
1150
+ # header parameters
1151
+ header_params = opts[:header_params] || {}
1152
+ # HTTP header 'Accept' (if needed)
1153
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1154
+
1155
+ # form parameters
1156
+ form_params = opts[:form_params] || {}
1157
+
1158
+ # http body (model)
1159
+ post_body = opts[:body]
1160
+
1161
+ # return_type
1162
+ return_type = opts[:return_type] || 'Locations'
1163
+
1164
+ # auth_names
1165
+ auth_names = opts[:auth_names] || ['accountID', 'appKey']
1166
+
1167
+ new_options = opts.merge(
1168
+ :header_params => header_params,
1169
+ :query_params => query_params,
1170
+ :form_params => form_params,
1171
+ :body => post_body,
1172
+ :auth_names => auth_names,
1173
+ :return_type => return_type
1174
+ )
1175
+
1176
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1177
+ if @api_client.config.debugging
1178
+ @api_client.config.logger.debug "API called: InventoryApi#get_locations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1179
+ end
1180
+ return data, status_code, headers
1181
+ end
1182
+
1048
1183
  # Allows you to retrieve your information
1049
1184
  # @param [Hash] opts the optional parameters
1050
1185
  # @return [Me]
@@ -1099,6 +1234,60 @@ module DearInventoryRuby
1099
1234
  return data, status_code, headers
1100
1235
  end
1101
1236
 
1237
+ # Allows you to retrieve the me contacts (Sales Representatives)
1238
+ # @param [Hash] opts the optional parameters
1239
+ # @return [MeContacts]
1240
+ def get_me_contacts(opts = {})
1241
+ data, _status_code, _headers = get_me_contacts_with_http_info(opts)
1242
+ data
1243
+ end
1244
+
1245
+ # Allows you to retrieve the me contacts (Sales Representatives)
1246
+ # @param [Hash] opts the optional parameters
1247
+ # @return [Array<(MeContacts, Integer, Hash)>] MeContacts data, response status code and response headers
1248
+ def get_me_contacts_with_http_info(opts = {})
1249
+ if @api_client.config.debugging
1250
+ @api_client.config.logger.debug 'Calling API: InventoryApi.get_me_contacts ...'
1251
+ end
1252
+ # resource path
1253
+ local_var_path = '/me/contacts'
1254
+
1255
+ # query parameters
1256
+ query_params = opts[:query_params] || {}
1257
+
1258
+ # header parameters
1259
+ header_params = opts[:header_params] || {}
1260
+ # HTTP header 'Accept' (if needed)
1261
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1262
+
1263
+ # form parameters
1264
+ form_params = opts[:form_params] || {}
1265
+
1266
+ # http body (model)
1267
+ post_body = opts[:body]
1268
+
1269
+ # return_type
1270
+ return_type = opts[:return_type] || 'MeContacts'
1271
+
1272
+ # auth_names
1273
+ auth_names = opts[:auth_names] || ['accountID', 'appKey']
1274
+
1275
+ new_options = opts.merge(
1276
+ :header_params => header_params,
1277
+ :query_params => query_params,
1278
+ :form_params => form_params,
1279
+ :body => post_body,
1280
+ :auth_names => auth_names,
1281
+ :return_type => return_type
1282
+ )
1283
+
1284
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1285
+ if @api_client.config.debugging
1286
+ @api_client.config.logger.debug "API called: InventoryApi#get_me_contacts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1287
+ end
1288
+ return data, status_code, headers
1289
+ end
1290
+
1102
1291
  # Allows you to retrieve the payment terms
1103
1292
  # @param [Hash] opts the optional parameters
1104
1293
  # @option opts [String] :page Default is 1 (default to '1')
@@ -191,34 +191,18 @@ module DearInventoryRuby
191
191
  invalid_properties.push('invalid value for "code", code cannot be nil.')
192
192
  end
193
193
 
194
- if @code.to_s.length > 50
195
- invalid_properties.push('invalid value for "code", the character length must be smaller than or equal to 50.')
196
- end
197
-
198
194
  if @name.nil?
199
195
  invalid_properties.push('invalid value for "name", name cannot be nil.')
200
196
  end
201
197
 
202
- if @name.to_s.length > 256
203
- invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 256.')
204
- end
205
-
206
198
  if @type.nil?
207
199
  invalid_properties.push('invalid value for "type", type cannot be nil.')
208
200
  end
209
201
 
210
- if @type.to_s.length > 50
211
- invalid_properties.push('invalid value for "type", the character length must be smaller than or equal to 50.')
212
- end
213
-
214
202
  if @status.nil?
215
203
  invalid_properties.push('invalid value for "status", status cannot be nil.')
216
204
  end
217
205
 
218
- if @status.to_s.length > 50
219
- invalid_properties.push('invalid value for "status", the character length must be smaller than or equal to 50.')
220
- end
221
-
222
206
  invalid_properties
223
207
  end
224
208
 
@@ -226,72 +210,12 @@ module DearInventoryRuby
226
210
  # @return true if the model is valid
227
211
  def valid?
228
212
  return false if @code.nil?
229
- return false if @code.to_s.length > 50
230
213
  return false if @name.nil?
231
- return false if @name.to_s.length > 256
232
214
  return false if @type.nil?
233
- return false if @type.to_s.length > 50
234
215
  return false if @status.nil?
235
- return false if @status.to_s.length > 50
236
216
  true
237
217
  end
238
218
 
239
- # Custom attribute writer method with validation
240
- # @param [Object] code Value to be assigned
241
- def code=(code)
242
- if code.nil?
243
- fail ArgumentError, 'code cannot be nil'
244
- end
245
-
246
- if code.to_s.length > 50
247
- fail ArgumentError, 'invalid value for "code", the character length must be smaller than or equal to 50.'
248
- end
249
-
250
- @code = code
251
- end
252
-
253
- # Custom attribute writer method with validation
254
- # @param [Object] name Value to be assigned
255
- def name=(name)
256
- if name.nil?
257
- fail ArgumentError, 'name cannot be nil'
258
- end
259
-
260
- if name.to_s.length > 256
261
- fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 256.'
262
- end
263
-
264
- @name = name
265
- end
266
-
267
- # Custom attribute writer method with validation
268
- # @param [Object] type Value to be assigned
269
- def type=(type)
270
- if type.nil?
271
- fail ArgumentError, 'type cannot be nil'
272
- end
273
-
274
- if type.to_s.length > 50
275
- fail ArgumentError, 'invalid value for "type", the character length must be smaller than or equal to 50.'
276
- end
277
-
278
- @type = type
279
- end
280
-
281
- # Custom attribute writer method with validation
282
- # @param [Object] status Value to be assigned
283
- def status=(status)
284
- if status.nil?
285
- fail ArgumentError, 'status cannot be nil'
286
- end
287
-
288
- if status.to_s.length > 50
289
- fail ArgumentError, 'invalid value for "status", the character length must be smaller than or equal to 50.'
290
- end
291
-
292
- @status = status
293
- end
294
-
295
219
  # Checks equality by comparing each attribute.
296
220
  # @param [Object] Object to be compared
297
221
  def ==(o)
@@ -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 Bin
17
+ # Unique ID
18
+ attr_accessor :id
19
+
20
+ # Name of `Bin`
21
+ attr_accessor :name
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'id' => :'ID',
27
+ :'name' => :'Name'
28
+ }
29
+ end
30
+
31
+ # Attribute type mapping.
32
+ def self.openapi_types
33
+ {
34
+ :'id' => :'String',
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::Bin` 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::Bin`. 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?(:'id')
61
+ self.id = attributes[:'id']
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
+ id == o.id &&
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
+ [id, 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