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