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