Class: DevmeSdk::CountryApi

Inherits:
Object
  • Object
show all
Defined in:
lib/devme-sdk-ruby/api/country_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CountryApi

Returns a new instance of CountryApi.



19
20
21
# File 'lib/devme-sdk-ruby/api/country_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/devme-sdk-ruby/api/country_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#v1_get_country_details(code, opts = {}) ⇒ GetCountryDetailsOut

Get country facts and information

Parameters:

  • code (String)

    code - country code ISO 4217

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

    the optional parameters

Options Hash (opts):

  • :expand (Array<String>)

    expand - expand properties

  • :exclude (Array<String>)

    exclude - exclude properties

  • :language (String)

    language - localisation language

Returns:



30
31
32
33
# File 'lib/devme-sdk-ruby/api/country_api.rb', line 30

def v1_get_country_details(code, opts = {})
  data, _status_code, _headers = v1_get_country_details_with_http_info(code, opts)
  data
end

#v1_get_country_details_with_http_info(code, opts = {}) ⇒ Array<(GetCountryDetailsOut, Integer, Hash)>

Get country facts and information

Parameters:

  • code (String)

    code - country code ISO 4217

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

    the optional parameters

Options Hash (opts):

  • :expand (Array<String>)

    expand - expand properties

  • :exclude (Array<String>)

    exclude - exclude properties

  • :language (String)

    language - localisation language

Returns:

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

    GetCountryDetailsOut data, response status code and response headers



42
43
44
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
88
89
90
91
92
93
94
95
96
# File 'lib/devme-sdk-ruby/api/country_api.rb', line 42

def v1_get_country_details_with_http_info(code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CountryApi.v1_get_country_details ...'
  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 CountryApi.v1_get_country_details"
  end
  allowable_values = ["en", "ar", "de", "es", "fr", "ja", "ko", "pt", "ru"]
  if @api_client.config.client_side_validation && opts[:'language'] && !allowable_values.include?(opts[:'language'])
    fail ArgumentError, "invalid value for \"language\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1-get-country-details'

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

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

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['APIKeyHeader', 'APIKeyQueryParam']

  new_options = opts.merge(
    :operation => :"CountryApi.v1_get_country_details",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CountryApi#v1_get_country_details\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#v1_list_countries(opts = {}) ⇒ ListCountriesOut

Get list of all countries

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :code (Array<String>)

    code - country code ISO 4217

  • :expand (Array<String>)

    expand - expand properties

  • :exclude (Array<String>)

    exclude - exclude properties

  • :language (String)

    language - localisation language

  • :sort (Array<String>)

    sort - sort properties

  • :page (String)

    page - page number

  • :page_size (String)

    pageSize - page size

Returns:



108
109
110
111
# File 'lib/devme-sdk-ruby/api/country_api.rb', line 108

def v1_list_countries(opts = {})
  data, _status_code, _headers = v1_list_countries_with_http_info(opts)
  data
end

#v1_list_countries_with_http_info(opts = {}) ⇒ Array<(ListCountriesOut, Integer, Hash)>

Get list of all countries

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :code (Array<String>)

    code - country code ISO 4217

  • :expand (Array<String>)

    expand - expand properties

  • :exclude (Array<String>)

    exclude - exclude properties

  • :language (String)

    language - localisation language

  • :sort (Array<String>)

    sort - sort properties

  • :page (String)

    page - page number

  • :page_size (String)

    pageSize - page size

Returns:

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

    ListCountriesOut data, response status code and response headers



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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/devme-sdk-ruby/api/country_api.rb', line 123

def v1_list_countries_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CountryApi.v1_list_countries ...'
  end
  allowable_values = ["en", "ar", "de", "es", "fr", "ja", "ko", "pt", "ru"]
  if @api_client.config.client_side_validation && opts[:'language'] && !allowable_values.include?(opts[:'language'])
    fail ArgumentError, "invalid value for \"language\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1-list-countries'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'code'] = @api_client.build_collection_param(opts[:'code'], :multi) if !opts[:'code'].nil?
  query_params[:'expand'] = @api_client.build_collection_param(opts[:'expand'], :multi) if !opts[:'expand'].nil?
  query_params[:'exclude'] = @api_client.build_collection_param(opts[:'exclude'], :multi) if !opts[:'exclude'].nil?
  query_params[:'language'] = opts[:'language'] if !opts[:'language'].nil?
  query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'pageSize'] = opts[:'page_size'] if !opts[:'page_size'].nil?

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

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['APIKeyHeader', 'APIKeyQueryParam']

  new_options = opts.merge(
    :operation => :"CountryApi.v1_list_countries",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CountryApi#v1_list_countries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end