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