tradenity 0.1.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +89 -77
  4. data/lib/tradenity/api_client.rb +408 -0
  5. data/lib/tradenity/api_error.rb +36 -0
  6. data/lib/tradenity/configuration.rb +205 -0
  7. data/lib/tradenity/exceptions.rb +5 -0
  8. data/lib/tradenity/rails/railtie.rb +20 -20
  9. data/lib/tradenity/resources/address.rb +729 -0
  10. data/lib/tradenity/resources/braintree_gateway.rb +804 -0
  11. data/lib/tradenity/resources/brand.rb +732 -0
  12. data/lib/tradenity/resources/cancel_operation.rb +675 -0
  13. data/lib/tradenity/resources/cart_settings.rb +219 -0
  14. data/lib/tradenity/resources/cash_on_delivery_payment.rb +746 -0
  15. data/lib/tradenity/resources/category.rb +763 -0
  16. data/lib/tradenity/resources/collection.rb +734 -0
  17. data/lib/tradenity/resources/contact_info.rb +306 -0
  18. data/lib/tradenity/resources/countries_geo_zone.rb +739 -0
  19. data/lib/tradenity/resources/country.rb +803 -0
  20. data/lib/tradenity/resources/coupon.rb +454 -0
  21. data/lib/tradenity/resources/credit_card_payment.rb +803 -0
  22. data/lib/tradenity/resources/currency.rb +762 -0
  23. data/lib/tradenity/resources/customer.rb +816 -0
  24. data/lib/tradenity/resources/customer_group.rb +723 -0
  25. data/lib/tradenity/resources/dimensions.rb +263 -0
  26. data/lib/tradenity/resources/discount_coupon.rb +811 -0
  27. data/lib/tradenity/resources/discount_promotion.rb +784 -0
  28. data/lib/tradenity/resources/fixed_rate_shipping.rb +837 -0
  29. data/lib/tradenity/resources/free_item_coupon.rb +793 -0
  30. data/lib/tradenity/resources/free_shipping.rb +806 -0
  31. data/lib/tradenity/resources/free_shipping_coupon.rb +788 -0
  32. data/lib/tradenity/resources/free_shipping_promotion.rb +744 -0
  33. data/lib/tradenity/resources/gateway.rb +435 -0
  34. data/lib/tradenity/resources/general_settings.rb +206 -0
  35. data/lib/tradenity/resources/geo_zone.rb +406 -0
  36. data/lib/tradenity/resources/instance_meta.rb +182 -0
  37. data/lib/tradenity/resources/inventory_settings.rb +197 -0
  38. data/lib/tradenity/resources/items_selector.rb +270 -0
  39. data/lib/tradenity/resources/line_item.rb +347 -0
  40. data/lib/tradenity/resources/mail_server_settings.rb +221 -0
  41. data/lib/tradenity/resources/measurement_settings.rb +253 -0
  42. data/lib/tradenity/resources/option.rb +787 -0
  43. data/lib/tradenity/resources/option_set.rb +734 -0
  44. data/lib/tradenity/resources/option_value.rb +680 -0
  45. data/lib/tradenity/resources/order.rb +929 -0
  46. data/lib/tradenity/resources/order_line_item.rb +777 -0
  47. data/lib/tradenity/resources/paging.rb +38 -0
  48. data/lib/tradenity/resources/payment.rb +429 -0
  49. data/lib/tradenity/resources/payment_card.rb +847 -0
  50. data/lib/tradenity/resources/payment_settings.rb +201 -0
  51. data/lib/tradenity/resources/payment_source.rb +392 -0
  52. data/lib/tradenity/resources/payment_token.rb +723 -0
  53. data/lib/tradenity/resources/payment_transaction.rb +740 -0
  54. data/lib/tradenity/resources/photo.rb +341 -0
  55. data/lib/tradenity/resources/product.rb +1156 -0
  56. data/lib/tradenity/resources/promotion.rb +427 -0
  57. data/lib/tradenity/resources/refund_operation.rb +358 -0
  58. data/lib/tradenity/resources/refund_transaction.rb +730 -0
  59. data/lib/tradenity/resources/return_line_item.rb +781 -0
  60. data/lib/tradenity/resources/return_operation.rb +686 -0
  61. data/lib/tradenity/resources/return_settings.rb +255 -0
  62. data/lib/tradenity/resources/shipping_method.rb +530 -0
  63. data/lib/tradenity/resources/shopping_cart.rb +647 -0
  64. data/lib/tradenity/resources/state.rb +675 -0
  65. data/lib/tradenity/resources/states_geo_zone.rb +748 -0
  66. data/lib/tradenity/resources/store_credit.rb +686 -0
  67. data/lib/tradenity/resources/store_credit_payment.rb +764 -0
  68. data/lib/tradenity/resources/store_credit_transaction.rb +730 -0
  69. data/lib/tradenity/resources/store_profile.rb +532 -0
  70. data/lib/tradenity/resources/stripe_gateway.rb +804 -0
  71. data/lib/tradenity/resources/table_rate_rule.rb +712 -0
  72. data/lib/tradenity/resources/table_rate_shipping.rb +834 -0
  73. data/lib/tradenity/resources/tax_class.rb +723 -0
  74. data/lib/tradenity/resources/tax_rate.rb +845 -0
  75. data/lib/tradenity/resources/tax_settings.rb +231 -0
  76. data/lib/tradenity/resources/test_gateway.rb +804 -0
  77. data/lib/tradenity/resources/transaction.rb +523 -0
  78. data/lib/tradenity/resources/utils.rb +7 -0
  79. data/lib/tradenity/resources/variant.rb +877 -0
  80. data/lib/tradenity/resources/web_hooks.rb +262 -0
  81. data/lib/tradenity/resources/weight.rb +235 -0
  82. data/lib/tradenity/resources/wish_list.rb +686 -0
  83. data/lib/tradenity/resources/zip_codes_geo_zone.rb +755 -0
  84. data/lib/tradenity/token_holder.rb +22 -0
  85. data/lib/tradenity/version.rb +13 -3
  86. data/lib/tradenity.rb +117 -7
  87. data/tradenity.gemspec +35 -30
  88. metadata +200 -34
  89. data/lib/tradenity/api.rb +0 -17
  90. data/lib/tradenity/error/exceptions.rb +0 -52
  91. data/lib/tradenity/error/message.rb +0 -38
  92. data/lib/tradenity/http/client.rb +0 -130
  93. data/lib/tradenity/model/base.rb +0 -100
  94. data/lib/tradenity/model/entities.rb +0 -390
  95. data/lib/tradenity/model/paging.rb +0 -23
@@ -0,0 +1,845 @@
1
+ =begin
2
+ #Tradenity API
3
+
4
+ #Tradenity eCommerce Rest API
5
+
6
+ Contact: support@tradenity.com
7
+ Generated by: https://github.com/tradenity
8
+
9
+ =end
10
+
11
+ require 'uri'
12
+
13
+ module Tradenity
14
+ class TaxRate
15
+
16
+
17
+ def id=(id)
18
+ @id = id
19
+ end
20
+
21
+ def id
22
+ if instance_variable_defined?('@id') && @id != nil
23
+ @id
24
+ elsif __meta && __meta.href != nil
25
+ @id = __meta.href.split('/')[-1]
26
+ @id
27
+ else
28
+ nil
29
+ end
30
+ end
31
+
32
+ attr_accessor :__meta
33
+
34
+ attr_accessor :created_at
35
+
36
+ attr_accessor :updated_at
37
+
38
+ attr_accessor :name
39
+
40
+ attr_accessor :description
41
+
42
+ attr_accessor :type
43
+
44
+ attr_accessor :percentage
45
+
46
+ attr_accessor :fixed_rate
47
+
48
+ attr_accessor :status
49
+
50
+ attr_accessor :tax_class
51
+
52
+ attr_accessor :geo_zone
53
+
54
+ attr_accessor :customer_groups
55
+
56
+ attr_accessor :based_on
57
+
58
+ class EnumAttributeValidator
59
+ attr_reader :datatype
60
+ attr_reader :allowable_values
61
+
62
+ def initialize(datatype, allowable_values)
63
+ @allowable_values = allowable_values.map do |value|
64
+ case datatype.to_s
65
+ when /Integer/i
66
+ value.to_i
67
+ when /Float/i
68
+ value.to_f
69
+ else
70
+ value
71
+ end
72
+ end
73
+ end
74
+
75
+ def valid?(value)
76
+ !value || allowable_values.include?(value)
77
+ end
78
+ end
79
+
80
+ # Attribute mapping from ruby-style variable name to JSON key.
81
+ def self.attribute_map
82
+ {
83
+ :'id' => :'id',
84
+ :'__meta' => :'__meta',
85
+ :'created_at' => :'createdAt',
86
+ :'updated_at' => :'updatedAt',
87
+ :'name' => :'name',
88
+ :'description' => :'description',
89
+ :'type' => :'type',
90
+ :'percentage' => :'percentage',
91
+ :'fixed_rate' => :'fixedRate',
92
+ :'status' => :'status',
93
+ :'tax_class' => :'taxClass',
94
+ :'geo_zone' => :'geoZone',
95
+ :'customer_groups' => :'customerGroups',
96
+ :'based_on' => :'basedOn'
97
+ }
98
+ end
99
+
100
+ # Attribute type mapping.
101
+ def self.swagger_types
102
+ {
103
+ :'id' => :'String',
104
+ :'__meta' => :'InstanceMeta',
105
+ :'created_at' => :'DateTime',
106
+ :'updated_at' => :'DateTime',
107
+ :'name' => :'String',
108
+ :'description' => :'String',
109
+ :'type' => :'String',
110
+ :'percentage' => :'Float',
111
+ :'fixed_rate' => :'Integer',
112
+ :'status' => :'String',
113
+ :'tax_class' => :'TaxClass',
114
+ :'geo_zone' => :'GeoZone',
115
+ :'customer_groups' => :'Array<CustomerGroup>',
116
+ :'based_on' => :'String'
117
+ }
118
+ end
119
+
120
+ # Initializes the object
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ def initialize(attributes = {})
123
+ return unless attributes.is_a?(Hash)
124
+
125
+ # convert string to symbol for hash key
126
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
127
+ if attributes.has_key?(:'id')
128
+ self.id = attributes[:'id']
129
+ end
130
+
131
+ if attributes.has_key?(:'__meta')
132
+ self.__meta = attributes[:'__meta']
133
+ end
134
+
135
+ if attributes.has_key?(:'createdAt')
136
+ self.created_at = attributes[:'createdAt']
137
+ end
138
+
139
+ if attributes.has_key?(:'created_at')
140
+ self.created_at = attributes[:'created_at']
141
+ end
142
+
143
+ if attributes.has_key?(:'updatedAt')
144
+ self.updated_at = attributes[:'updatedAt']
145
+ end
146
+
147
+ if attributes.has_key?(:'updated_at')
148
+ self.updated_at = attributes[:'updated_at']
149
+ end
150
+
151
+ if attributes.has_key?(:'name')
152
+ self.name = attributes[:'name']
153
+ end
154
+
155
+ if attributes.has_key?(:'description')
156
+ self.description = attributes[:'description']
157
+ end
158
+
159
+ if attributes.has_key?(:'type')
160
+ self.type = attributes[:'type']
161
+ end
162
+
163
+ if attributes.has_key?(:'percentage')
164
+ self.percentage = attributes[:'percentage']
165
+ end
166
+
167
+ if attributes.has_key?(:'fixedRate')
168
+ self.fixed_rate = attributes[:'fixedRate']
169
+ end
170
+
171
+ if attributes.has_key?(:'fixed_rate')
172
+ self.fixed_rate = attributes[:'fixed_rate']
173
+ end
174
+
175
+ if attributes.has_key?(:'status')
176
+ self.status = attributes[:'status']
177
+ end
178
+
179
+ if attributes.has_key?(:'taxClass')
180
+ self.tax_class = attributes[:'taxClass']
181
+ end
182
+
183
+ if attributes.has_key?(:'tax_class')
184
+ self.tax_class = attributes[:'tax_class']
185
+ end
186
+
187
+ if attributes.has_key?(:'geoZone')
188
+ self.geo_zone = attributes[:'geoZone']
189
+ end
190
+
191
+ if attributes.has_key?(:'geo_zone')
192
+ self.geo_zone = attributes[:'geo_zone']
193
+ end
194
+
195
+ if attributes.has_key?(:'customerGroups')
196
+ if (value = attributes[:'customerGroups']).is_a?(Array)
197
+ self.customer_groups = value
198
+ end
199
+ end
200
+
201
+ if attributes.has_key?(:'customer_groups')
202
+ if (value = attributes[:'customer_groups']).is_a?(Array)
203
+ self.customer_groups = value
204
+ end
205
+ end
206
+
207
+ if attributes.has_key?(:'basedOn')
208
+ self.based_on = attributes[:'basedOn']
209
+ end
210
+
211
+ if attributes.has_key?(:'based_on')
212
+ self.based_on = attributes[:'based_on']
213
+ end
214
+ end
215
+
216
+ # Show invalid properties with the reasons. Usually used together with valid?
217
+ # @return Array for valid properties with the reasons
218
+ def list_invalid_properties
219
+ invalid_properties = Array.new
220
+ if @name.nil?
221
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
222
+ end
223
+
224
+ if @type.nil?
225
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
226
+ end
227
+
228
+ if @percentage.nil?
229
+ invalid_properties.push('invalid value for "percentage", percentage cannot be nil.')
230
+ end
231
+
232
+ if @fixed_rate.nil?
233
+ invalid_properties.push('invalid value for "fixed_rate", fixed_rate cannot be nil.')
234
+ end
235
+
236
+ if @status.nil?
237
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
238
+ end
239
+
240
+ if @tax_class.nil?
241
+ invalid_properties.push('invalid value for "tax_class", tax_class cannot be nil.')
242
+ end
243
+
244
+ if @geo_zone.nil?
245
+ invalid_properties.push('invalid value for "geo_zone", geo_zone cannot be nil.')
246
+ end
247
+
248
+ invalid_properties
249
+ end
250
+
251
+ # Check to see if the all the properties in the model are valid
252
+ # @return true if the model is valid
253
+ def valid?
254
+ return false if @name.nil?
255
+ return false if @type.nil?
256
+ type_validator = EnumAttributeValidator.new('String', ['percentage', 'fixed'])
257
+ return false unless type_validator.valid?(@type)
258
+ return false if @percentage.nil?
259
+ return false if @fixed_rate.nil?
260
+ return false if @status.nil?
261
+ status_validator = EnumAttributeValidator.new('String', ['enabled', 'disabled'])
262
+ return false unless status_validator.valid?(@status)
263
+ return false if @tax_class.nil?
264
+ return false if @geo_zone.nil?
265
+ based_on_validator = EnumAttributeValidator.new('String', ['shippingAddress', 'billingAddress'])
266
+ return false unless based_on_validator.valid?(@based_on)
267
+ true
268
+ end
269
+
270
+ # Custom attribute writer method checking allowed values (enum).
271
+ # @param [Object] type Object to be assigned
272
+ def type=(type)
273
+ validator = EnumAttributeValidator.new('String', ['percentage', 'fixed'])
274
+ unless validator.valid?(type)
275
+ fail ArgumentError, 'invalid value for "type", must be one of #{validator.allowable_values}.'
276
+ end
277
+ @type = type
278
+ end
279
+
280
+ # Custom attribute writer method checking allowed values (enum).
281
+ # @param [Object] status Object to be assigned
282
+ def status=(status)
283
+ validator = EnumAttributeValidator.new('String', ['enabled', 'disabled'])
284
+ unless validator.valid?(status)
285
+ fail ArgumentError, 'invalid value for "status", must be one of #{validator.allowable_values}.'
286
+ end
287
+ @status = status
288
+ end
289
+
290
+ # Custom attribute writer method checking allowed values (enum).
291
+ # @param [Object] based_on Object to be assigned
292
+ def based_on=(based_on)
293
+ validator = EnumAttributeValidator.new('String', ['shippingAddress', 'billingAddress'])
294
+ unless validator.valid?(based_on)
295
+ fail ArgumentError, 'invalid value for "based_on", must be one of #{validator.allowable_values}.'
296
+ end
297
+ @based_on = based_on
298
+ end
299
+
300
+ # Checks equality by comparing each attribute.
301
+ # @param [Object] Object to be compared
302
+ def ==(o)
303
+ return true if self.equal?(o)
304
+ self.class == o.class &&
305
+ __meta == o.__meta &&
306
+ created_at == o.created_at &&
307
+ updated_at == o.updated_at &&
308
+ name == o.name &&
309
+ description == o.description &&
310
+ type == o.type &&
311
+ percentage == o.percentage &&
312
+ fixed_rate == o.fixed_rate &&
313
+ status == o.status &&
314
+ tax_class == o.tax_class &&
315
+ geo_zone == o.geo_zone &&
316
+ customer_groups == o.customer_groups &&
317
+ based_on == o.based_on
318
+ end
319
+
320
+ # @see the `==` method
321
+ # @param [Object] Object to be compared
322
+ def eql?(o)
323
+ self == o
324
+ end
325
+
326
+ # Calculates hash code according to all attributes.
327
+ # @return [Fixnum] Hash code
328
+ def hash
329
+ [__meta, created_at, updated_at, name, description, type, percentage, fixed_rate, status, tax_class, geo_zone, customer_groups, based_on].hash
330
+ end
331
+
332
+ # Builds the object from hash
333
+ # @param [Hash] attributes Model attributes in the form of hash
334
+ # @return [Object] Returns the model itself
335
+ def build_from_hash(attributes)
336
+ return nil unless attributes.is_a?(Hash)
337
+ self.class.swagger_types.each_pair do |key, type|
338
+ if type =~ /\AArray<(.*)>/i
339
+ # check to ensure the input is an array given that the the attribute
340
+ # is documented as an array but the input is not
341
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
342
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
343
+ end
344
+ elsif !attributes[self.class.attribute_map[key]].nil?
345
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
346
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
347
+ end
348
+
349
+ self
350
+ end
351
+
352
+ # Deserializes the data based on type
353
+ # @param string type Data type
354
+ # @param string value Value to be deserialized
355
+ # @return [Object] Deserialized data
356
+ def _deserialize(type, value)
357
+ case type.to_sym
358
+ when :DateTime
359
+ DateTime.parse(value)
360
+ when :Date
361
+ Date.parse(value)
362
+ when :String
363
+ value.to_s
364
+ when :Integer
365
+ value.to_i
366
+ when :Float
367
+ value.to_f
368
+ when :BOOLEAN
369
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
370
+ true
371
+ else
372
+ false
373
+ end
374
+ when :Object
375
+ # generic object (usually a Hash), return directly
376
+ value
377
+ when /\AArray<(?<inner_type>.+)>\z/
378
+ inner_type = Regexp.last_match[:inner_type]
379
+ value.map { |v| _deserialize(inner_type, v) }
380
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
381
+ k_type = Regexp.last_match[:k_type]
382
+ v_type = Regexp.last_match[:v_type]
383
+ {}.tap do |hash|
384
+ value.each do |k, v|
385
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
386
+ end
387
+ end
388
+ else # model
389
+ temp_model = Tradenity.const_get(type).new
390
+ temp_model.build_from_hash(value)
391
+ end
392
+ end
393
+
394
+ # Returns the string representation of the object
395
+ # @return [String] String presentation of the object
396
+ def to_s
397
+ to_hash.to_s
398
+ end
399
+
400
+ # to_body is an alias to to_hash (backward compatibility)
401
+ # @return [Hash] Returns the object in the form of hash
402
+ def to_body
403
+ to_hash
404
+ end
405
+
406
+ # Returns the object in the form of hash
407
+ # @return [Hash] Returns the object in the form of hash
408
+ def to_hash
409
+ hash = {}
410
+ self.class.attribute_map.each_pair do |attr, param|
411
+ value = self.send(attr)
412
+ next if value.nil?
413
+ hash[param] = _to_hash(value)
414
+ end
415
+ hash
416
+ end
417
+
418
+ # Outputs non-array value in the form of hash
419
+ # For object, use to_hash. Otherwise, just return the value
420
+ # @param [Object] value Any valid value
421
+ # @return [Hash] Returns the value in the form of hash
422
+ def _to_hash(value)
423
+ if value.is_a?(Array)
424
+ value.compact.map { |v| _to_hash(v) }
425
+ elsif value.is_a?(Hash)
426
+ {}.tap do |hash|
427
+ value.each { |k, v| hash[k] = _to_hash(v) }
428
+ end
429
+ elsif value.respond_to? :to_hash
430
+ value.to_hash
431
+ else
432
+ value
433
+ end
434
+ end
435
+
436
+
437
+ def self.api_client
438
+ ApiClient.default
439
+ end
440
+
441
+ # Create TaxRate
442
+ # Create a new TaxRate
443
+ def create
444
+ data = self.class.create_tax_rate(self)
445
+ self.id = data.id
446
+ data
447
+ end
448
+
449
+ # Update TaxRate
450
+ # Update attributes of TaxRate
451
+ # @return [TaxRate]
452
+ def update
453
+ self.class.update_tax_rate_by_id(self.id, self)
454
+ end
455
+
456
+ # Delete TaxRate
457
+ # Delete this instance of TaxRate.
458
+ # @return [nil]
459
+ def delete
460
+ self.class.delete_tax_rate_by_id(self.id)
461
+ end
462
+
463
+ class << self
464
+
465
+ # List TaxRates
466
+ # Return a list of TaxRates
467
+ # @param [Hash] opts the optional parameters
468
+ # @return [Page<TaxRate>]
469
+ def find_all
470
+ list_all_tax_rates
471
+ end
472
+
473
+ # Find List of TaxRate
474
+ # Return multiple instances of TaxRate by its attributes.
475
+ # @param [Hash] opts the search parameters
476
+ # @return [Page<Collection>]
477
+ def find_all_by(opts = {})
478
+ list_all_tax_rates(opts)
479
+ end
480
+
481
+ # Find TaxRate by its parameters
482
+ # Return single instance of Collection by its attributes.
483
+ # @param [Hash] opts search parameters
484
+ # @return [TaxRate]
485
+ def find_one_by(opts = {})
486
+ list_all_tax_rates(opts)[0]
487
+ end
488
+
489
+ # Find TaxRate
490
+ # Return single instance of TaxRate by its ID.
491
+ # @param id ID of TaxRate to return
492
+ # @return [TaxRate]
493
+ def find_by_id(id)
494
+ get_tax_rate_by_id(id)
495
+ end
496
+
497
+ # Delete TaxRate
498
+ # Delete an instance of TaxRate by its ID.
499
+ # @param id ID of TaxRate to delete.
500
+ # @return [nil]
501
+ def delete_by_id(id)
502
+ delete_tax_rate_by_id(id)
503
+ end
504
+
505
+ # Create TaxRate
506
+ # Create a new TaxRate
507
+ # @param tax_rate Attributes of taxRate to create
508
+ # @param [Hash] opts the optional parameters
509
+ # @return [TaxRate]
510
+ def create_tax_rate(tax_rate, opts = {})
511
+ data, _status_code, _headers = create_tax_rate_with_http_info(tax_rate, opts)
512
+ data
513
+ end
514
+
515
+ # Create TaxRate
516
+ # Create a new TaxRate
517
+ # @param tax_rate Attributes of taxRate to create
518
+ # @param [Hash] opts the optional parameters
519
+ # @return [Array<(TaxRate, Fixnum, Hash)>] TaxRate data, response status code and response headers
520
+ def create_tax_rate_with_http_info(tax_rate, opts = {})
521
+ if api_client.config.debugging
522
+ api_client.config.logger.debug 'Calling API: TaxRate.create_tax_rate ...'
523
+ end
524
+ # verify the required parameter 'tax_rate' is set
525
+ if api_client.config.client_side_validation && tax_rate.nil?
526
+ fail ArgumentError, "Missing the required parameter 'tax_rate' when calling TaxRate.create_tax_rate"
527
+ end
528
+ # resource path
529
+ local_var_path = '/taxRates'
530
+
531
+ # query parameters
532
+ query_params = opts
533
+
534
+ # header parameters
535
+ header_params = {}
536
+ # HTTP header 'Accept' (if needed)
537
+ header_params['Accept'] = api_client.select_header_accept(['application/json'])
538
+ # HTTP header 'Content-Type'
539
+ header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
540
+
541
+ # form parameters
542
+ form_params = {}
543
+
544
+ # http body (model)
545
+ post_body = api_client.object_to_http_body(tax_rate)
546
+ auth_names = []
547
+ data, status_code, headers = api_client.call_api(:POST, local_var_path,
548
+ :header_params => header_params,
549
+ :query_params => query_params,
550
+ :form_params => form_params,
551
+ :body => post_body,
552
+ :auth_names => auth_names,
553
+ :return_type => 'TaxRate')
554
+ if api_client.config.debugging
555
+ api_client.config.logger.debug "API called: TaxRate#create_tax_rate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
556
+ end
557
+ return data, status_code, headers
558
+ end
559
+ # Delete TaxRate
560
+ # Delete an instance of TaxRate by its ID.
561
+ # @param tax_rate_id ID of taxRate to delete.
562
+ # @param [Hash] opts the optional parameters
563
+ # @return [nil]
564
+ def delete_tax_rate_by_id(tax_rate_id, opts = {})
565
+ delete_tax_rate_by_id_with_http_info(tax_rate_id, opts)
566
+ nil
567
+ end
568
+
569
+ # Delete TaxRate
570
+ # Delete an instance of TaxRate by its ID.
571
+ # @param tax_rate_id ID of taxRate to delete.
572
+ # @param [Hash] opts the optional parameters
573
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
574
+ def delete_tax_rate_by_id_with_http_info(tax_rate_id, opts = {})
575
+ if api_client.config.debugging
576
+ api_client.config.logger.debug 'Calling API: TaxRate.delete_tax_rate_by_id ...'
577
+ end
578
+ # verify the required parameter 'tax_rate_id' is set
579
+ if api_client.config.client_side_validation && tax_rate_id.nil?
580
+ fail ArgumentError, "Missing the required parameter 'tax_rate_id' when calling TaxRate.delete_tax_rate_by_id"
581
+ end
582
+ # resource path
583
+ local_var_path = '/taxRates/{taxRateId}'.sub('{' + 'taxRateId' + '}', tax_rate_id.to_s)
584
+
585
+ # query parameters
586
+ query_params = opts
587
+
588
+ # header parameters
589
+ header_params = {}
590
+ # HTTP header 'Accept' (if needed)
591
+ header_params['Accept'] = api_client.select_header_accept(['application/json'])
592
+ # HTTP header 'Content-Type'
593
+ header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
594
+
595
+ # form parameters
596
+ form_params = {}
597
+
598
+ # http body (model)
599
+ post_body = nil
600
+ auth_names = []
601
+ data, status_code, headers = api_client.call_api(:DELETE, local_var_path,
602
+ :header_params => header_params,
603
+ :query_params => query_params,
604
+ :form_params => form_params,
605
+ :body => post_body,
606
+ :auth_names => auth_names)
607
+ if api_client.config.debugging
608
+ api_client.config.logger.debug "API called: TaxRate#delete_tax_rate_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
609
+ end
610
+ return data, status_code, headers
611
+ end
612
+ # Find TaxRate
613
+ # Return single instance of TaxRate by its ID.
614
+ # @param tax_rate_id ID of taxRate to return
615
+ # @param [Hash] opts the optional parameters
616
+ # @return [TaxRate]
617
+ def get_tax_rate_by_id(tax_rate_id, opts = {})
618
+ data, _status_code, _headers = get_tax_rate_by_id_with_http_info(tax_rate_id, opts)
619
+ data
620
+ end
621
+
622
+ # Find TaxRate
623
+ # Return single instance of TaxRate by its ID.
624
+ # @param tax_rate_id ID of taxRate to return
625
+ # @param [Hash] opts the optional parameters
626
+ # @return [Array<(TaxRate, Fixnum, Hash)>] TaxRate data, response status code and response headers
627
+ def get_tax_rate_by_id_with_http_info(tax_rate_id, opts = {})
628
+ if api_client.config.debugging
629
+ api_client.config.logger.debug 'Calling API: TaxRate.get_tax_rate_by_id ...'
630
+ end
631
+ # verify the required parameter 'tax_rate_id' is set
632
+ if api_client.config.client_side_validation && tax_rate_id.nil?
633
+ fail ArgumentError, "Missing the required parameter 'tax_rate_id' when calling TaxRate.get_tax_rate_by_id"
634
+ end
635
+ # resource path
636
+ local_var_path = '/taxRates/{taxRateId}'.sub('{' + 'taxRateId' + '}', tax_rate_id.to_s)
637
+
638
+ # query parameters
639
+ query_params = opts
640
+
641
+ # header parameters
642
+ header_params = {}
643
+ # HTTP header 'Accept' (if needed)
644
+ header_params['Accept'] = api_client.select_header_accept(['application/json'])
645
+ # HTTP header 'Content-Type'
646
+ header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
647
+
648
+ # form parameters
649
+ form_params = {}
650
+
651
+ # http body (model)
652
+ post_body = nil
653
+ auth_names = []
654
+ data, status_code, headers = api_client.call_api(:GET, local_var_path,
655
+ :header_params => header_params,
656
+ :query_params => query_params,
657
+ :form_params => form_params,
658
+ :body => post_body,
659
+ :auth_names => auth_names,
660
+ :return_type => 'TaxRate')
661
+ if api_client.config.debugging
662
+ api_client.config.logger.debug "API called: TaxRate#get_tax_rate_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
663
+ end
664
+ return data, status_code, headers
665
+ end
666
+ # List TaxRates
667
+ # Return a list of TaxRates
668
+ # @param [Hash] opts the optional parameters
669
+ # @option opts [Integer] :page page number
670
+ # @option opts [Integer] :size page size
671
+ # @option opts [String] :sort page order
672
+ # @return [Page<TaxRate>]
673
+ def list_all_tax_rates(opts = {})
674
+ data, _status_code, _headers = list_all_tax_rates_with_http_info(opts)
675
+ data
676
+ end
677
+
678
+ # List TaxRates
679
+ # Return a list of TaxRates
680
+ # @param [Hash] opts the optional parameters
681
+ # @option opts [Integer] :page page number
682
+ # @option opts [Integer] :size page size
683
+ # @option opts [String] :sort page order
684
+ # @return [Array<(Page<TaxRate>, Fixnum, Hash)>] Page<TaxRate> data, response status code and response headers
685
+ def list_all_tax_rates_with_http_info(opts = {})
686
+ if api_client.config.debugging
687
+ api_client.config.logger.debug 'Calling API: TaxRate.list_all_tax_rates ...'
688
+ end
689
+ # resource path
690
+ local_var_path = '/taxRates'
691
+
692
+ # query parameters
693
+ query_params = opts
694
+ # query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
695
+ # query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
696
+ # query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
697
+
698
+ # header parameters
699
+ header_params = {}
700
+ # HTTP header 'Accept' (if needed)
701
+ header_params['Accept'] = api_client.select_header_accept(['application/json'])
702
+ # HTTP header 'Content-Type'
703
+ header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
704
+
705
+ # form parameters
706
+ form_params = {}
707
+
708
+ # http body (model)
709
+ post_body = nil
710
+ auth_names = []
711
+ data, status_code, headers = api_client.call_api(:GET, local_var_path,
712
+ :header_params => header_params,
713
+ :query_params => query_params,
714
+ :form_params => form_params,
715
+ :body => post_body,
716
+ :auth_names => auth_names,
717
+ :return_type => 'Page<TaxRate>')
718
+ if api_client.config.debugging
719
+ api_client.config.logger.debug "API called: TaxRate#list_all_tax_rates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
720
+ end
721
+ return data, status_code, headers
722
+ end
723
+ # Replace TaxRate
724
+ # Replace all attributes of TaxRate
725
+ # @param tax_rate_id ID of taxRate to replace
726
+ # @param tax_rate Attributes of taxRate to replace
727
+ # @param [Hash] opts the optional parameters
728
+ # @return [TaxRate]
729
+ def replace_tax_rate_by_id(tax_rate_id, tax_rate, opts = {})
730
+ data, _status_code, _headers = replace_tax_rate_by_id_with_http_info(tax_rate_id, tax_rate, opts)
731
+ data
732
+ end
733
+
734
+ # Replace TaxRate
735
+ # Replace all attributes of TaxRate
736
+ # @param tax_rate_id ID of taxRate to replace
737
+ # @param tax_rate Attributes of taxRate to replace
738
+ # @param [Hash] opts the optional parameters
739
+ # @return [Array<(TaxRate, Fixnum, Hash)>] TaxRate data, response status code and response headers
740
+ def replace_tax_rate_by_id_with_http_info(tax_rate_id, tax_rate, opts = {})
741
+ if api_client.config.debugging
742
+ api_client.config.logger.debug 'Calling API: TaxRate.replace_tax_rate_by_id ...'
743
+ end
744
+ # verify the required parameter 'tax_rate_id' is set
745
+ if api_client.config.client_side_validation && tax_rate_id.nil?
746
+ fail ArgumentError, "Missing the required parameter 'tax_rate_id' when calling TaxRate.replace_tax_rate_by_id"
747
+ end
748
+ # verify the required parameter 'tax_rate' is set
749
+ if api_client.config.client_side_validation && tax_rate.nil?
750
+ fail ArgumentError, "Missing the required parameter 'tax_rate' when calling TaxRate.replace_tax_rate_by_id"
751
+ end
752
+ # resource path
753
+ local_var_path = '/taxRates/{taxRateId}'.sub('{' + 'taxRateId' + '}', tax_rate_id.to_s)
754
+
755
+ # query parameters
756
+ query_params = opts
757
+
758
+ # header parameters
759
+ header_params = {}
760
+ # HTTP header 'Accept' (if needed)
761
+ header_params['Accept'] = api_client.select_header_accept(['application/json'])
762
+ # HTTP header 'Content-Type'
763
+ header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
764
+
765
+ # form parameters
766
+ form_params = {}
767
+
768
+ # http body (model)
769
+ post_body = api_client.object_to_http_body(tax_rate)
770
+ auth_names = []
771
+ data, status_code, headers = api_client.call_api(:PUT, local_var_path,
772
+ :header_params => header_params,
773
+ :query_params => query_params,
774
+ :form_params => form_params,
775
+ :body => post_body,
776
+ :auth_names => auth_names,
777
+ :return_type => 'TaxRate')
778
+ if api_client.config.debugging
779
+ api_client.config.logger.debug "API called: TaxRate#replace_tax_rate_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
780
+ end
781
+ return data, status_code, headers
782
+ end
783
+ # Update TaxRate
784
+ # Update attributes of TaxRate
785
+ # @param tax_rate_id ID of taxRate to update.
786
+ # @param tax_rate Attributes of taxRate to update.
787
+ # @param [Hash] opts the optional parameters
788
+ # @return [TaxRate]
789
+ def update_tax_rate_by_id(tax_rate_id, tax_rate, opts = {})
790
+ data, _status_code, _headers = update_tax_rate_by_id_with_http_info(tax_rate_id, tax_rate, opts)
791
+ data
792
+ end
793
+
794
+ # Update TaxRate
795
+ # Update attributes of TaxRate
796
+ # @param tax_rate_id ID of taxRate to update.
797
+ # @param tax_rate Attributes of taxRate to update.
798
+ # @param [Hash] opts the optional parameters
799
+ # @return [Array<(TaxRate, Fixnum, Hash)>] TaxRate data, response status code and response headers
800
+ def update_tax_rate_by_id_with_http_info(tax_rate_id, tax_rate, opts = {})
801
+ if api_client.config.debugging
802
+ api_client.config.logger.debug 'Calling API: TaxRate.update_tax_rate_by_id ...'
803
+ end
804
+ # verify the required parameter 'tax_rate_id' is set
805
+ if api_client.config.client_side_validation && tax_rate_id.nil?
806
+ fail ArgumentError, "Missing the required parameter 'tax_rate_id' when calling TaxRate.update_tax_rate_by_id"
807
+ end
808
+ # verify the required parameter 'tax_rate' is set
809
+ if api_client.config.client_side_validation && tax_rate.nil?
810
+ fail ArgumentError, "Missing the required parameter 'tax_rate' when calling TaxRate.update_tax_rate_by_id"
811
+ end
812
+ # resource path
813
+ local_var_path = '/taxRates/{taxRateId}'.sub('{' + 'taxRateId' + '}', tax_rate_id.to_s)
814
+
815
+ # query parameters
816
+ query_params = opts
817
+
818
+ # header parameters
819
+ header_params = {}
820
+ # HTTP header 'Accept' (if needed)
821
+ header_params['Accept'] = api_client.select_header_accept(['application/json'])
822
+ # HTTP header 'Content-Type'
823
+ header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
824
+
825
+ # form parameters
826
+ form_params = {}
827
+
828
+ # http body (model)
829
+ post_body = api_client.object_to_http_body(tax_rate)
830
+ auth_names = []
831
+ data, status_code, headers = api_client.call_api(:PATCH, local_var_path,
832
+ :header_params => header_params,
833
+ :query_params => query_params,
834
+ :form_params => form_params,
835
+ :body => post_body,
836
+ :auth_names => auth_names,
837
+ :return_type => 'TaxRate')
838
+ if api_client.config.debugging
839
+ api_client.config.logger.debug "API called: TaxRate#update_tax_rate_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
840
+ end
841
+ return data, status_code, headers
842
+ end
843
+ end
844
+ end
845
+ end