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