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