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