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