Class: WalleeRubySdk::CountriesService

Inherits:
Object
  • Object
show all
Defined in:
lib/wallee-ruby-sdk/service/countries_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CountriesService

Returns a new instance of CountriesService.



28
29
30
# File 'lib/wallee-ruby-sdk/service/countries_service.rb', line 28

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



25
26
27
# File 'lib/wallee-ruby-sdk/service/countries_service.rb', line 25

def api_client
  @api_client
end

Instance Method Details

#get_countries(opts = {}) ⇒ CountryListResponse

List all countries

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :expand (Array<String>)

Returns:



35
36
37
38
# File 'lib/wallee-ruby-sdk/service/countries_service.rb', line 35

def get_countries(opts = {})
  data, _status_code, _headers = get_countries_with_http_info(opts)
  data
end

#get_countries_code(code, opts = {}) ⇒ RestCountry

Retrieve a country

Parameters:

  • code (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :expand (Array<String>)

Returns:



95
96
97
98
# File 'lib/wallee-ruby-sdk/service/countries_service.rb', line 95

def get_countries_code(code, opts = {})
  data, _status_code, _headers = get_countries_code_with_http_info(code, opts)
  data
end

#get_countries_code_with_http_info(code, opts = {}) ⇒ Array<(RestCountry, Integer, Hash)>

Returns RestCountry data, response status code and response headers.

Parameters:

  • code (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :expand (Array<String>)

Returns:

  • (Array<(RestCountry, Integer, Hash)>)

    RestCountry data, response status code and response headers



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/wallee-ruby-sdk/service/countries_service.rb', line 106

def get_countries_code_with_http_info(code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CountriesService.get_countries_code ...'
  end
  # verify the required parameter 'code' is set
  if @api_client.config.client_side_validation && code.nil?
    fail ArgumentError, "Missing the required parameter 'code' when calling CountriesService.get_countries_code"
  end
  # resource path
  local_var_path = '/countries/{code}'.sub('{' + 'code' + '}', CGI.escape(code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) unless opts[:'expand'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # connection timeout
  connection_timeout = @api_client.config.timeout

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'RestCountry'

  new_options = opts.merge(
    :operation => :"CountriesService.get_countries_code",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET.to_sym.downcase, local_var_path, new_options, connection_timeout)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CountriesService#get_countries_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}\nConnection Timeout: #{connection_timeout}"
  end
  return data, status_code, headers
end

#get_countries_country_code_states(country_code, opts = {}) ⇒ Array<RestCountryState>

List all states for a country

Parameters:

  • country_code (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



159
160
161
162
# File 'lib/wallee-ruby-sdk/service/countries_service.rb', line 159

def get_countries_country_code_states(country_code, opts = {})
  data, _status_code, _headers = get_countries_country_code_states_with_http_info(country_code, opts)
  data
end

#get_countries_country_code_states_with_http_info(country_code, opts = {}) ⇒ Array<(Array<RestCountryState>, Integer, Hash)>

Returns Array<RestCountryState> data, response status code and response headers.

Parameters:

  • country_code (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Array<RestCountryState>, Integer, Hash)>)

    Array<RestCountryState> data, response status code and response headers



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/wallee-ruby-sdk/service/countries_service.rb', line 169

def get_countries_country_code_states_with_http_info(country_code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CountriesService.get_countries_country_code_states ...'
  end
  # verify the required parameter 'country_code' is set
  if @api_client.config.client_side_validation && country_code.nil?
    fail ArgumentError, "Missing the required parameter 'country_code' when calling CountriesService.get_countries_country_code_states"
  end
  # resource path
  local_var_path = '/countries/{countryCode}/states'.sub('{' + 'countryCode' + '}', CGI.escape(country_code.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # connection timeout
  connection_timeout = @api_client.config.timeout

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<RestCountryState>'

  new_options = opts.merge(
    :operation => :"CountriesService.get_countries_country_code_states",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET.to_sym.downcase, local_var_path, new_options, connection_timeout)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CountriesService#get_countries_country_code_states\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}\nConnection Timeout: #{connection_timeout}"
  end
  return data, status_code, headers
end

#get_countries_search(opts = {}) ⇒ CountrySearchResponse

Search countries

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :expand (Array<String>)
  • :limit (Integer)

    A limit on the number of objects to be returned, between 1 and 100. Default is 10.

  • :offset (Integer)

    A cursor for pagination, specifies the number of objects to skip.

  • :order (String)

    The fields and order to sort the objects by.

  • :query (String)

    The search query to filter the objects by.

Returns:



225
226
227
228
# File 'lib/wallee-ruby-sdk/service/countries_service.rb', line 225

def get_countries_search(opts = {})
  data, _status_code, _headers = get_countries_search_with_http_info(opts)
  data
end

#get_countries_search_with_http_info(opts = {}) ⇒ Array<(CountrySearchResponse, Integer, Hash)>

Returns CountrySearchResponse data, response status code and response headers.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :expand (Array<String>)
  • :limit (Integer)

    A limit on the number of objects to be returned, between 1 and 100. Default is 10.

  • :offset (Integer)

    A cursor for pagination, specifies the number of objects to skip.

  • :order (String)

    The fields and order to sort the objects by.

  • :query (String)

    The search query to filter the objects by.

Returns:

  • (Array<(CountrySearchResponse, Integer, Hash)>)

    CountrySearchResponse data, response status code and response headers



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/wallee-ruby-sdk/service/countries_service.rb', line 239

def get_countries_search_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CountriesService.get_countries_search ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CountriesService.get_countries_search, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CountriesService.get_countries_search, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] > 10000
    fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling CountriesService.get_countries_search, must be smaller than or equal to 10000.'
  end

  # resource path
  local_var_path = '/countries/search'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) unless opts[:'expand'].nil?
  query_params[:'limit'] = opts[:'limit'] unless opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] unless opts[:'offset'].nil?
  query_params[:'order'] = opts[:'order'] unless opts[:'order'].nil?
  query_params[:'query'] = opts[:'query'] unless opts[:'query'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # connection timeout
  connection_timeout = @api_client.config.timeout

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CountrySearchResponse'

  new_options = opts.merge(
    :operation => :"CountriesService.get_countries_search",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET.to_sym.downcase, local_var_path, new_options, connection_timeout)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CountriesService#get_countries_search\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}\nConnection Timeout: #{connection_timeout}"
  end
  return data, status_code, headers
end

#get_countries_states(opts = {}) ⇒ Array<RestCountryState>

List all country states

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



303
304
305
306
# File 'lib/wallee-ruby-sdk/service/countries_service.rb', line 303

def get_countries_states(opts = {})
  data, _status_code, _headers = get_countries_states_with_http_info(opts)
  data
end

#get_countries_states_id(id, opts = {}) ⇒ RestCountryState

Retrieve a country state

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



360
361
362
363
# File 'lib/wallee-ruby-sdk/service/countries_service.rb', line 360

def get_countries_states_id(id, opts = {})
  data, _status_code, _headers = get_countries_states_id_with_http_info(id, opts)
  data
end

#get_countries_states_id_with_http_info(id, opts = {}) ⇒ Array<(RestCountryState, Integer, Hash)>

Returns RestCountryState data, response status code and response headers.

Parameters:

  • id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RestCountryState, Integer, Hash)>)

    RestCountryState data, response status code and response headers



370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# File 'lib/wallee-ruby-sdk/service/countries_service.rb', line 370

def get_countries_states_id_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CountriesService.get_countries_states_id ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling CountriesService.get_countries_states_id"
  end
  # resource path
  local_var_path = '/countries/states/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # connection timeout
  connection_timeout = @api_client.config.timeout

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'RestCountryState'

  new_options = opts.merge(
    :operation => :"CountriesService.get_countries_states_id",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET.to_sym.downcase, local_var_path, new_options, connection_timeout)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CountriesService#get_countries_states_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}\nConnection Timeout: #{connection_timeout}"
  end
  return data, status_code, headers
end

#get_countries_states_with_http_info(opts = {}) ⇒ Array<(Array<RestCountryState>, Integer, Hash)>

Returns Array<RestCountryState> data, response status code and response headers.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Array<RestCountryState>, Integer, Hash)>)

    Array<RestCountryState> data, response status code and response headers



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/wallee-ruby-sdk/service/countries_service.rb', line 312

def get_countries_states_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CountriesService.get_countries_states ...'
  end
  # resource path
  local_var_path = '/countries/states'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # connection timeout
  connection_timeout = @api_client.config.timeout

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<RestCountryState>'

  new_options = opts.merge(
    :operation => :"CountriesService.get_countries_states",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET.to_sym.downcase, local_var_path, new_options, connection_timeout)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CountriesService#get_countries_states\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}\nConnection Timeout: #{connection_timeout}"
  end
  return data, status_code, headers
end

#get_countries_with_http_info(opts = {}) ⇒ Array<(CountryListResponse, Integer, Hash)>

Returns CountryListResponse data, response status code and response headers.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :expand (Array<String>)

Returns:

  • (Array<(CountryListResponse, Integer, Hash)>)

    CountryListResponse data, response status code and response headers



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/wallee-ruby-sdk/service/countries_service.rb', line 45

def get_countries_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CountriesService.get_countries ...'
  end
  # resource path
  local_var_path = '/countries'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) unless opts[:'expand'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # connection timeout
  connection_timeout = @api_client.config.timeout

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CountryListResponse'

  new_options = opts.merge(
    :operation => :"CountriesService.get_countries",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET.to_sym.downcase, local_var_path, new_options, connection_timeout)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CountriesService#get_countries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}\nConnection Timeout: #{connection_timeout}"
  end
  return data, status_code, headers
end