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