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