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