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