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