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