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