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,712 @@
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 TableRateRule
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 :minimum
39
+
40
+ attr_accessor :maximum
41
+
42
+ attr_accessor :cost
43
+
44
+ attr_accessor :unit
45
+
46
+ attr_accessor :table_rate_shipping
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'id' => :'id',
52
+ :'__meta' => :'__meta',
53
+ :'created_at' => :'createdAt',
54
+ :'updated_at' => :'updatedAt',
55
+ :'minimum' => :'minimum',
56
+ :'maximum' => :'maximum',
57
+ :'cost' => :'cost',
58
+ :'unit' => :'unit',
59
+ :'table_rate_shipping' => :'tableRateShipping'
60
+ }
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.swagger_types
65
+ {
66
+ :'id' => :'String',
67
+ :'__meta' => :'InstanceMeta',
68
+ :'created_at' => :'DateTime',
69
+ :'updated_at' => :'DateTime',
70
+ :'minimum' => :'Integer',
71
+ :'maximum' => :'Integer',
72
+ :'cost' => :'Integer',
73
+ :'unit' => :'String',
74
+ :'table_rate_shipping' => :'TableRateShipping'
75
+ }
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ return unless attributes.is_a?(Hash)
82
+
83
+ # convert string to symbol for hash key
84
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
85
+ if attributes.has_key?(:'id')
86
+ self.id = attributes[:'id']
87
+ end
88
+
89
+ if attributes.has_key?(:'__meta')
90
+ self.__meta = attributes[:'__meta']
91
+ end
92
+
93
+ if attributes.has_key?(:'createdAt')
94
+ self.created_at = attributes[:'createdAt']
95
+ end
96
+
97
+ if attributes.has_key?(:'created_at')
98
+ self.created_at = attributes[:'created_at']
99
+ end
100
+
101
+ if attributes.has_key?(:'updatedAt')
102
+ self.updated_at = attributes[:'updatedAt']
103
+ end
104
+
105
+ if attributes.has_key?(:'updated_at')
106
+ self.updated_at = attributes[:'updated_at']
107
+ end
108
+
109
+ if attributes.has_key?(:'minimum')
110
+ self.minimum = attributes[:'minimum']
111
+ end
112
+
113
+ if attributes.has_key?(:'maximum')
114
+ self.maximum = attributes[:'maximum']
115
+ end
116
+
117
+ if attributes.has_key?(:'cost')
118
+ self.cost = attributes[:'cost']
119
+ end
120
+
121
+ if attributes.has_key?(:'unit')
122
+ self.unit = attributes[:'unit']
123
+ end
124
+
125
+ if attributes.has_key?(:'tableRateShipping')
126
+ self.table_rate_shipping = attributes[:'tableRateShipping']
127
+ end
128
+
129
+ if attributes.has_key?(:'table_rate_shipping')
130
+ self.table_rate_shipping = attributes[:'table_rate_shipping']
131
+ end
132
+ end
133
+
134
+ # Show invalid properties with the reasons. Usually used together with valid?
135
+ # @return Array for valid properties with the reasons
136
+ def list_invalid_properties
137
+ invalid_properties = Array.new
138
+ if @minimum.nil?
139
+ invalid_properties.push('invalid value for "minimum", minimum cannot be nil.')
140
+ end
141
+
142
+ if @maximum.nil?
143
+ invalid_properties.push('invalid value for "maximum", maximum cannot be nil.')
144
+ end
145
+
146
+ if @cost.nil?
147
+ invalid_properties.push('invalid value for "cost", cost cannot be nil.')
148
+ end
149
+
150
+ if @unit.nil?
151
+ invalid_properties.push('invalid value for "unit", unit cannot be nil.')
152
+ end
153
+
154
+ if @table_rate_shipping.nil?
155
+ invalid_properties.push('invalid value for "table_rate_shipping", table_rate_shipping cannot be nil.')
156
+ end
157
+
158
+ invalid_properties
159
+ end
160
+
161
+ # Check to see if the all the properties in the model are valid
162
+ # @return true if the model is valid
163
+ def valid?
164
+ return false if @minimum.nil?
165
+ return false if @maximum.nil?
166
+ return false if @cost.nil?
167
+ return false if @unit.nil?
168
+ return false if @table_rate_shipping.nil?
169
+ true
170
+ end
171
+
172
+ # Checks equality by comparing each attribute.
173
+ # @param [Object] Object to be compared
174
+ def ==(o)
175
+ return true if self.equal?(o)
176
+ self.class == o.class &&
177
+ __meta == o.__meta &&
178
+ created_at == o.created_at &&
179
+ updated_at == o.updated_at &&
180
+ minimum == o.minimum &&
181
+ maximum == o.maximum &&
182
+ cost == o.cost &&
183
+ unit == o.unit &&
184
+ table_rate_shipping == o.table_rate_shipping
185
+ end
186
+
187
+ # @see the `==` method
188
+ # @param [Object] Object to be compared
189
+ def eql?(o)
190
+ self == o
191
+ end
192
+
193
+ # Calculates hash code according to all attributes.
194
+ # @return [Fixnum] Hash code
195
+ def hash
196
+ [__meta, created_at, updated_at, minimum, maximum, cost, unit, table_rate_shipping].hash
197
+ end
198
+
199
+ # Builds the object from hash
200
+ # @param [Hash] attributes Model attributes in the form of hash
201
+ # @return [Object] Returns the model itself
202
+ def build_from_hash(attributes)
203
+ return nil unless attributes.is_a?(Hash)
204
+ self.class.swagger_types.each_pair do |key, type|
205
+ if type =~ /\AArray<(.*)>/i
206
+ # check to ensure the input is an array given that the the attribute
207
+ # is documented as an array but the input is not
208
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
209
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
210
+ end
211
+ elsif !attributes[self.class.attribute_map[key]].nil?
212
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
213
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
214
+ end
215
+
216
+ self
217
+ end
218
+
219
+ # Deserializes the data based on type
220
+ # @param string type Data type
221
+ # @param string value Value to be deserialized
222
+ # @return [Object] Deserialized data
223
+ def _deserialize(type, value)
224
+ case type.to_sym
225
+ when :DateTime
226
+ DateTime.parse(value)
227
+ when :Date
228
+ Date.parse(value)
229
+ when :String
230
+ value.to_s
231
+ when :Integer
232
+ value.to_i
233
+ when :Float
234
+ value.to_f
235
+ when :BOOLEAN
236
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
237
+ true
238
+ else
239
+ false
240
+ end
241
+ when :Object
242
+ # generic object (usually a Hash), return directly
243
+ value
244
+ when /\AArray<(?<inner_type>.+)>\z/
245
+ inner_type = Regexp.last_match[:inner_type]
246
+ value.map { |v| _deserialize(inner_type, v) }
247
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
248
+ k_type = Regexp.last_match[:k_type]
249
+ v_type = Regexp.last_match[:v_type]
250
+ {}.tap do |hash|
251
+ value.each do |k, v|
252
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
253
+ end
254
+ end
255
+ else # model
256
+ temp_model = Tradenity.const_get(type).new
257
+ temp_model.build_from_hash(value)
258
+ end
259
+ end
260
+
261
+ # Returns the string representation of the object
262
+ # @return [String] String presentation of the object
263
+ def to_s
264
+ to_hash.to_s
265
+ end
266
+
267
+ # to_body is an alias to to_hash (backward compatibility)
268
+ # @return [Hash] Returns the object in the form of hash
269
+ def to_body
270
+ to_hash
271
+ end
272
+
273
+ # Returns the object in the form of hash
274
+ # @return [Hash] Returns the object in the form of hash
275
+ def to_hash
276
+ hash = {}
277
+ self.class.attribute_map.each_pair do |attr, param|
278
+ value = self.send(attr)
279
+ next if value.nil?
280
+ hash[param] = _to_hash(value)
281
+ end
282
+ hash
283
+ end
284
+
285
+ # Outputs non-array value in the form of hash
286
+ # For object, use to_hash. Otherwise, just return the value
287
+ # @param [Object] value Any valid value
288
+ # @return [Hash] Returns the value in the form of hash
289
+ def _to_hash(value)
290
+ if value.is_a?(Array)
291
+ value.compact.map { |v| _to_hash(v) }
292
+ elsif value.is_a?(Hash)
293
+ {}.tap do |hash|
294
+ value.each { |k, v| hash[k] = _to_hash(v) }
295
+ end
296
+ elsif value.respond_to? :to_hash
297
+ value.to_hash
298
+ else
299
+ value
300
+ end
301
+ end
302
+
303
+
304
+ def self.api_client
305
+ ApiClient.default
306
+ end
307
+
308
+ # Create TableRateRule
309
+ # Create a new TableRateRule
310
+ def create
311
+ data = self.class.create_table_rate_rule(self)
312
+ self.id = data.id
313
+ data
314
+ end
315
+
316
+ # Update TableRateRule
317
+ # Update attributes of TableRateRule
318
+ # @return [TableRateRule]
319
+ def update
320
+ self.class.update_table_rate_rule_by_id(self.id, self)
321
+ end
322
+
323
+ # Delete TableRateRule
324
+ # Delete this instance of TableRateRule.
325
+ # @return [nil]
326
+ def delete
327
+ self.class.delete_table_rate_rule_by_id(self.id)
328
+ end
329
+
330
+ class << self
331
+
332
+ # List TableRateRules
333
+ # Return a list of TableRateRules
334
+ # @param [Hash] opts the optional parameters
335
+ # @return [Page<TableRateRule>]
336
+ def find_all
337
+ list_all_table_rate_rules
338
+ end
339
+
340
+ # Find List of TableRateRule
341
+ # Return multiple instances of TableRateRule by its attributes.
342
+ # @param [Hash] opts the search parameters
343
+ # @return [Page<Collection>]
344
+ def find_all_by(opts = {})
345
+ list_all_table_rate_rules(opts)
346
+ end
347
+
348
+ # Find TableRateRule by its parameters
349
+ # Return single instance of Collection by its attributes.
350
+ # @param [Hash] opts search parameters
351
+ # @return [TableRateRule]
352
+ def find_one_by(opts = {})
353
+ list_all_table_rate_rules(opts)[0]
354
+ end
355
+
356
+ # Find TableRateRule
357
+ # Return single instance of TableRateRule by its ID.
358
+ # @param id ID of TableRateRule to return
359
+ # @return [TableRateRule]
360
+ def find_by_id(id)
361
+ get_table_rate_rule_by_id(id)
362
+ end
363
+
364
+ # Delete TableRateRule
365
+ # Delete an instance of TableRateRule by its ID.
366
+ # @param id ID of TableRateRule to delete.
367
+ # @return [nil]
368
+ def delete_by_id(id)
369
+ delete_table_rate_rule_by_id(id)
370
+ end
371
+
372
+ # Create TableRateRule
373
+ # Create a new TableRateRule
374
+ # @param table_rate_rule Attributes of tableRateRule to create
375
+ # @param [Hash] opts the optional parameters
376
+ # @return [TableRateRule]
377
+ def create_table_rate_rule(table_rate_rule, opts = {})
378
+ data, _status_code, _headers = create_table_rate_rule_with_http_info(table_rate_rule, opts)
379
+ data
380
+ end
381
+
382
+ # Create TableRateRule
383
+ # Create a new TableRateRule
384
+ # @param table_rate_rule Attributes of tableRateRule to create
385
+ # @param [Hash] opts the optional parameters
386
+ # @return [Array<(TableRateRule, Fixnum, Hash)>] TableRateRule data, response status code and response headers
387
+ def create_table_rate_rule_with_http_info(table_rate_rule, opts = {})
388
+ if api_client.config.debugging
389
+ api_client.config.logger.debug 'Calling API: TableRateRule.create_table_rate_rule ...'
390
+ end
391
+ # verify the required parameter 'table_rate_rule' is set
392
+ if api_client.config.client_side_validation && table_rate_rule.nil?
393
+ fail ArgumentError, "Missing the required parameter 'table_rate_rule' when calling TableRateRule.create_table_rate_rule"
394
+ end
395
+ # resource path
396
+ local_var_path = '/tableRateRules'
397
+
398
+ # query parameters
399
+ query_params = opts
400
+
401
+ # header parameters
402
+ header_params = {}
403
+ # HTTP header 'Accept' (if needed)
404
+ header_params['Accept'] = api_client.select_header_accept(['application/json'])
405
+ # HTTP header 'Content-Type'
406
+ header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
407
+
408
+ # form parameters
409
+ form_params = {}
410
+
411
+ # http body (model)
412
+ post_body = api_client.object_to_http_body(table_rate_rule)
413
+ auth_names = []
414
+ data, status_code, headers = api_client.call_api(:POST, local_var_path,
415
+ :header_params => header_params,
416
+ :query_params => query_params,
417
+ :form_params => form_params,
418
+ :body => post_body,
419
+ :auth_names => auth_names,
420
+ :return_type => 'TableRateRule')
421
+ if api_client.config.debugging
422
+ api_client.config.logger.debug "API called: TableRateRule#create_table_rate_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
423
+ end
424
+ return data, status_code, headers
425
+ end
426
+ # Delete TableRateRule
427
+ # Delete an instance of TableRateRule by its ID.
428
+ # @param table_rate_rule_id ID of tableRateRule to delete.
429
+ # @param [Hash] opts the optional parameters
430
+ # @return [nil]
431
+ def delete_table_rate_rule_by_id(table_rate_rule_id, opts = {})
432
+ delete_table_rate_rule_by_id_with_http_info(table_rate_rule_id, opts)
433
+ nil
434
+ end
435
+
436
+ # Delete TableRateRule
437
+ # Delete an instance of TableRateRule by its ID.
438
+ # @param table_rate_rule_id ID of tableRateRule to delete.
439
+ # @param [Hash] opts the optional parameters
440
+ # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
441
+ def delete_table_rate_rule_by_id_with_http_info(table_rate_rule_id, opts = {})
442
+ if api_client.config.debugging
443
+ api_client.config.logger.debug 'Calling API: TableRateRule.delete_table_rate_rule_by_id ...'
444
+ end
445
+ # verify the required parameter 'table_rate_rule_id' is set
446
+ if api_client.config.client_side_validation && table_rate_rule_id.nil?
447
+ fail ArgumentError, "Missing the required parameter 'table_rate_rule_id' when calling TableRateRule.delete_table_rate_rule_by_id"
448
+ end
449
+ # resource path
450
+ local_var_path = '/tableRateRules/{tableRateRuleId}'.sub('{' + 'tableRateRuleId' + '}', table_rate_rule_id.to_s)
451
+
452
+ # query parameters
453
+ query_params = opts
454
+
455
+ # header parameters
456
+ header_params = {}
457
+ # HTTP header 'Accept' (if needed)
458
+ header_params['Accept'] = api_client.select_header_accept(['application/json'])
459
+ # HTTP header 'Content-Type'
460
+ header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
461
+
462
+ # form parameters
463
+ form_params = {}
464
+
465
+ # http body (model)
466
+ post_body = nil
467
+ auth_names = []
468
+ data, status_code, headers = api_client.call_api(:DELETE, local_var_path,
469
+ :header_params => header_params,
470
+ :query_params => query_params,
471
+ :form_params => form_params,
472
+ :body => post_body,
473
+ :auth_names => auth_names)
474
+ if api_client.config.debugging
475
+ api_client.config.logger.debug "API called: TableRateRule#delete_table_rate_rule_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
476
+ end
477
+ return data, status_code, headers
478
+ end
479
+ # Find TableRateRule
480
+ # Return single instance of TableRateRule by its ID.
481
+ # @param table_rate_rule_id ID of tableRateRule to return
482
+ # @param [Hash] opts the optional parameters
483
+ # @return [TableRateRule]
484
+ def get_table_rate_rule_by_id(table_rate_rule_id, opts = {})
485
+ data, _status_code, _headers = get_table_rate_rule_by_id_with_http_info(table_rate_rule_id, opts)
486
+ data
487
+ end
488
+
489
+ # Find TableRateRule
490
+ # Return single instance of TableRateRule by its ID.
491
+ # @param table_rate_rule_id ID of tableRateRule to return
492
+ # @param [Hash] opts the optional parameters
493
+ # @return [Array<(TableRateRule, Fixnum, Hash)>] TableRateRule data, response status code and response headers
494
+ def get_table_rate_rule_by_id_with_http_info(table_rate_rule_id, opts = {})
495
+ if api_client.config.debugging
496
+ api_client.config.logger.debug 'Calling API: TableRateRule.get_table_rate_rule_by_id ...'
497
+ end
498
+ # verify the required parameter 'table_rate_rule_id' is set
499
+ if api_client.config.client_side_validation && table_rate_rule_id.nil?
500
+ fail ArgumentError, "Missing the required parameter 'table_rate_rule_id' when calling TableRateRule.get_table_rate_rule_by_id"
501
+ end
502
+ # resource path
503
+ local_var_path = '/tableRateRules/{tableRateRuleId}'.sub('{' + 'tableRateRuleId' + '}', table_rate_rule_id.to_s)
504
+
505
+ # query parameters
506
+ query_params = opts
507
+
508
+ # header parameters
509
+ header_params = {}
510
+ # HTTP header 'Accept' (if needed)
511
+ header_params['Accept'] = api_client.select_header_accept(['application/json'])
512
+ # HTTP header 'Content-Type'
513
+ header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
514
+
515
+ # form parameters
516
+ form_params = {}
517
+
518
+ # http body (model)
519
+ post_body = nil
520
+ auth_names = []
521
+ data, status_code, headers = api_client.call_api(:GET, local_var_path,
522
+ :header_params => header_params,
523
+ :query_params => query_params,
524
+ :form_params => form_params,
525
+ :body => post_body,
526
+ :auth_names => auth_names,
527
+ :return_type => 'TableRateRule')
528
+ if api_client.config.debugging
529
+ api_client.config.logger.debug "API called: TableRateRule#get_table_rate_rule_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
530
+ end
531
+ return data, status_code, headers
532
+ end
533
+ # List TableRateRules
534
+ # Return a list of TableRateRules
535
+ # @param [Hash] opts the optional parameters
536
+ # @option opts [Integer] :page page number
537
+ # @option opts [Integer] :size page size
538
+ # @option opts [String] :sort page order
539
+ # @return [Page<TableRateRule>]
540
+ def list_all_table_rate_rules(opts = {})
541
+ data, _status_code, _headers = list_all_table_rate_rules_with_http_info(opts)
542
+ data
543
+ end
544
+
545
+ # List TableRateRules
546
+ # Return a list of TableRateRules
547
+ # @param [Hash] opts the optional parameters
548
+ # @option opts [Integer] :page page number
549
+ # @option opts [Integer] :size page size
550
+ # @option opts [String] :sort page order
551
+ # @return [Array<(Page<TableRateRule>, Fixnum, Hash)>] Page<TableRateRule> data, response status code and response headers
552
+ def list_all_table_rate_rules_with_http_info(opts = {})
553
+ if api_client.config.debugging
554
+ api_client.config.logger.debug 'Calling API: TableRateRule.list_all_table_rate_rules ...'
555
+ end
556
+ # resource path
557
+ local_var_path = '/tableRateRules'
558
+
559
+ # query parameters
560
+ query_params = opts
561
+ # query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
562
+ # query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
563
+ # query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
564
+
565
+ # header parameters
566
+ header_params = {}
567
+ # HTTP header 'Accept' (if needed)
568
+ header_params['Accept'] = api_client.select_header_accept(['application/json'])
569
+ # HTTP header 'Content-Type'
570
+ header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
571
+
572
+ # form parameters
573
+ form_params = {}
574
+
575
+ # http body (model)
576
+ post_body = nil
577
+ auth_names = []
578
+ data, status_code, headers = api_client.call_api(:GET, local_var_path,
579
+ :header_params => header_params,
580
+ :query_params => query_params,
581
+ :form_params => form_params,
582
+ :body => post_body,
583
+ :auth_names => auth_names,
584
+ :return_type => 'Page<TableRateRule>')
585
+ if api_client.config.debugging
586
+ api_client.config.logger.debug "API called: TableRateRule#list_all_table_rate_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
587
+ end
588
+ return data, status_code, headers
589
+ end
590
+ # Replace TableRateRule
591
+ # Replace all attributes of TableRateRule
592
+ # @param table_rate_rule_id ID of tableRateRule to replace
593
+ # @param table_rate_rule Attributes of tableRateRule to replace
594
+ # @param [Hash] opts the optional parameters
595
+ # @return [TableRateRule]
596
+ def replace_table_rate_rule_by_id(table_rate_rule_id, table_rate_rule, opts = {})
597
+ data, _status_code, _headers = replace_table_rate_rule_by_id_with_http_info(table_rate_rule_id, table_rate_rule, opts)
598
+ data
599
+ end
600
+
601
+ # Replace TableRateRule
602
+ # Replace all attributes of TableRateRule
603
+ # @param table_rate_rule_id ID of tableRateRule to replace
604
+ # @param table_rate_rule Attributes of tableRateRule to replace
605
+ # @param [Hash] opts the optional parameters
606
+ # @return [Array<(TableRateRule, Fixnum, Hash)>] TableRateRule data, response status code and response headers
607
+ def replace_table_rate_rule_by_id_with_http_info(table_rate_rule_id, table_rate_rule, opts = {})
608
+ if api_client.config.debugging
609
+ api_client.config.logger.debug 'Calling API: TableRateRule.replace_table_rate_rule_by_id ...'
610
+ end
611
+ # verify the required parameter 'table_rate_rule_id' is set
612
+ if api_client.config.client_side_validation && table_rate_rule_id.nil?
613
+ fail ArgumentError, "Missing the required parameter 'table_rate_rule_id' when calling TableRateRule.replace_table_rate_rule_by_id"
614
+ end
615
+ # verify the required parameter 'table_rate_rule' is set
616
+ if api_client.config.client_side_validation && table_rate_rule.nil?
617
+ fail ArgumentError, "Missing the required parameter 'table_rate_rule' when calling TableRateRule.replace_table_rate_rule_by_id"
618
+ end
619
+ # resource path
620
+ local_var_path = '/tableRateRules/{tableRateRuleId}'.sub('{' + 'tableRateRuleId' + '}', table_rate_rule_id.to_s)
621
+
622
+ # query parameters
623
+ query_params = opts
624
+
625
+ # header parameters
626
+ header_params = {}
627
+ # HTTP header 'Accept' (if needed)
628
+ header_params['Accept'] = api_client.select_header_accept(['application/json'])
629
+ # HTTP header 'Content-Type'
630
+ header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
631
+
632
+ # form parameters
633
+ form_params = {}
634
+
635
+ # http body (model)
636
+ post_body = api_client.object_to_http_body(table_rate_rule)
637
+ auth_names = []
638
+ data, status_code, headers = api_client.call_api(:PUT, local_var_path,
639
+ :header_params => header_params,
640
+ :query_params => query_params,
641
+ :form_params => form_params,
642
+ :body => post_body,
643
+ :auth_names => auth_names,
644
+ :return_type => 'TableRateRule')
645
+ if api_client.config.debugging
646
+ api_client.config.logger.debug "API called: TableRateRule#replace_table_rate_rule_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
647
+ end
648
+ return data, status_code, headers
649
+ end
650
+ # Update TableRateRule
651
+ # Update attributes of TableRateRule
652
+ # @param table_rate_rule_id ID of tableRateRule to update.
653
+ # @param table_rate_rule Attributes of tableRateRule to update.
654
+ # @param [Hash] opts the optional parameters
655
+ # @return [TableRateRule]
656
+ def update_table_rate_rule_by_id(table_rate_rule_id, table_rate_rule, opts = {})
657
+ data, _status_code, _headers = update_table_rate_rule_by_id_with_http_info(table_rate_rule_id, table_rate_rule, opts)
658
+ data
659
+ end
660
+
661
+ # Update TableRateRule
662
+ # Update attributes of TableRateRule
663
+ # @param table_rate_rule_id ID of tableRateRule to update.
664
+ # @param table_rate_rule Attributes of tableRateRule to update.
665
+ # @param [Hash] opts the optional parameters
666
+ # @return [Array<(TableRateRule, Fixnum, Hash)>] TableRateRule data, response status code and response headers
667
+ def update_table_rate_rule_by_id_with_http_info(table_rate_rule_id, table_rate_rule, opts = {})
668
+ if api_client.config.debugging
669
+ api_client.config.logger.debug 'Calling API: TableRateRule.update_table_rate_rule_by_id ...'
670
+ end
671
+ # verify the required parameter 'table_rate_rule_id' is set
672
+ if api_client.config.client_side_validation && table_rate_rule_id.nil?
673
+ fail ArgumentError, "Missing the required parameter 'table_rate_rule_id' when calling TableRateRule.update_table_rate_rule_by_id"
674
+ end
675
+ # verify the required parameter 'table_rate_rule' is set
676
+ if api_client.config.client_side_validation && table_rate_rule.nil?
677
+ fail ArgumentError, "Missing the required parameter 'table_rate_rule' when calling TableRateRule.update_table_rate_rule_by_id"
678
+ end
679
+ # resource path
680
+ local_var_path = '/tableRateRules/{tableRateRuleId}'.sub('{' + 'tableRateRuleId' + '}', table_rate_rule_id.to_s)
681
+
682
+ # query parameters
683
+ query_params = opts
684
+
685
+ # header parameters
686
+ header_params = {}
687
+ # HTTP header 'Accept' (if needed)
688
+ header_params['Accept'] = api_client.select_header_accept(['application/json'])
689
+ # HTTP header 'Content-Type'
690
+ header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])
691
+
692
+ # form parameters
693
+ form_params = {}
694
+
695
+ # http body (model)
696
+ post_body = api_client.object_to_http_body(table_rate_rule)
697
+ auth_names = []
698
+ data, status_code, headers = api_client.call_api(:PATCH, local_var_path,
699
+ :header_params => header_params,
700
+ :query_params => query_params,
701
+ :form_params => form_params,
702
+ :body => post_body,
703
+ :auth_names => auth_names,
704
+ :return_type => 'TableRateRule')
705
+ if api_client.config.debugging
706
+ api_client.config.logger.debug "API called: TableRateRule#update_table_rate_rule_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
707
+ end
708
+ return data, status_code, headers
709
+ end
710
+ end
711
+ end
712
+ end