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