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