Class: DevmeSdk::CurrencyApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ CurrencyApi

Returns a new instance of CurrencyApi.



19
20
21
# File 'lib/devme-sdk-ruby/api/currency_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/currency_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#v1_convert_currency(from, to, opts = {}) ⇒ ConvertCurrencyOut

Convert currency to another currency

Parameters:

  • from (String)

    from - currency to convert from

  • to (String)

    to - currency to convert to

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

    the optional parameters

Options Hash (opts):

  • :amount (Float)

    amount - amount to convert

Returns:



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

def v1_convert_currency(from, to, opts = {})
  data, _status_code, _headers = v1_convert_currency_with_http_info(from, to, opts)
  data
end

#v1_convert_currency_with_http_info(from, to, opts = {}) ⇒ Array<(ConvertCurrencyOut, Integer, Hash)>

Convert currency to another currency

Parameters:

  • from (String)

    from - currency to convert from

  • to (String)

    to - currency to convert to

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

    the optional parameters

Options Hash (opts):

  • :amount (Float)

    amount - amount to convert

Returns:

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

    ConvertCurrencyOut data, response status code and response headers



40
41
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
# File 'lib/devme-sdk-ruby/api/currency_api.rb', line 40

def v1_convert_currency_with_http_info(from, to, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CurrencyApi.v1_convert_currency ...'
  end
  # verify the required parameter 'from' is set
  if @api_client.config.client_side_validation && from.nil?
    fail ArgumentError, "Missing the required parameter 'from' when calling CurrencyApi.v1_convert_currency"
  end
  # verify the required parameter 'to' is set
  if @api_client.config.client_side_validation && to.nil?
    fail ArgumentError, "Missing the required parameter 'to' when calling CurrencyApi.v1_convert_currency"
  end
  # resource path
  local_var_path = '/v1-convert-currency'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'from'] = from
  query_params[:'to'] = to
  query_params[:'amount'] = opts[:'amount'] if !opts[:'amount'].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] || 'ConvertCurrencyOut'

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

  new_options = opts.merge(
    :operation => :"CurrencyApi.v1_convert_currency",
    :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: CurrencyApi#v1_convert_currency\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#v1_get_currency_details(code, opts = {}) ⇒ GetCurrencyDetailsOut

Get currency facts and information

Parameters:

  • code (String)

    code - currency 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

  • :type (String)

    type - type of currency

Returns:



103
104
105
106
# File 'lib/devme-sdk-ruby/api/currency_api.rb', line 103

def v1_get_currency_details(code, opts = {})
  data, _status_code, _headers = v1_get_currency_details_with_http_info(code, opts)
  data
end

#v1_get_currency_details_with_http_info(code, opts = {}) ⇒ Array<(GetCurrencyDetailsOut, Integer, Hash)>

Get currency facts and information

Parameters:

  • code (String)

    code - currency 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

  • :type (String)

    type - type of currency

Returns:

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

    GetCurrencyDetailsOut data, response status code and response headers



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

def v1_get_currency_details_with_http_info(code, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CurrencyApi.v1_get_currency_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 CurrencyApi.v1_get_currency_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
  allowable_values = ["fiat", "crypto"]
  if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])
    fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1-get-currency-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?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].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] || 'GetCurrencyDetailsOut'

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

  new_options = opts.merge(
    :operation => :"CurrencyApi.v1_get_currency_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: CurrencyApi#v1_get_currency_details\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#v1_get_currency_exchange_rate(from, to, opts = {}) ⇒ GetCurrencyExchangeRateOut

Get exchange rate for a currency

Parameters:

  • from (String)

    from - currency to get exchange rate from

  • to (String)

    to - currency to get exchange rate to

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

    the optional parameters

Returns:



182
183
184
185
# File 'lib/devme-sdk-ruby/api/currency_api.rb', line 182

def v1_get_currency_exchange_rate(from, to, opts = {})
  data, _status_code, _headers = v1_get_currency_exchange_rate_with_http_info(from, to, opts)
  data
end

#v1_get_currency_exchange_rate_with_http_info(from, to, opts = {}) ⇒ Array<(GetCurrencyExchangeRateOut, Integer, Hash)>

Get exchange rate for a currency

Parameters:

  • from (String)

    from - currency to get exchange rate from

  • to (String)

    to - currency to get exchange rate to

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

    the optional parameters

Returns:

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

    GetCurrencyExchangeRateOut data, response status code and response headers



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/devme-sdk-ruby/api/currency_api.rb', line 192

def v1_get_currency_exchange_rate_with_http_info(from, to, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CurrencyApi.v1_get_currency_exchange_rate ...'
  end
  # verify the required parameter 'from' is set
  if @api_client.config.client_side_validation && from.nil?
    fail ArgumentError, "Missing the required parameter 'from' when calling CurrencyApi.v1_get_currency_exchange_rate"
  end
  # verify the required parameter 'to' is set
  if @api_client.config.client_side_validation && to.nil?
    fail ArgumentError, "Missing the required parameter 'to' when calling CurrencyApi.v1_get_currency_exchange_rate"
  end
  # resource path
  local_var_path = '/v1-get-currency-exchange-rate'

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

  # 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] || 'GetCurrencyExchangeRateOut'

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

  new_options = opts.merge(
    :operation => :"CurrencyApi.v1_get_currency_exchange_rate",
    :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: CurrencyApi#v1_get_currency_exchange_rate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#v1_list_currencies(opts = {}) ⇒ ListCurrenciesOut

Get list of all currencies

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :code (Array<String>)

    code - currency code ISO 4217

  • :expand (Array<String>)

    expand - expand properties

  • :exclude (Array<String>)

    exclude - exclude properties

  • :language (String)

    language - localisation language

  • :type (String)

    type - type of currency

  • :sort (Array<String>)

    sort - sort properties

  • :page (String)

    page - page number

  • :page_size (String)

    pageSize - page size

Returns:



257
258
259
260
# File 'lib/devme-sdk-ruby/api/currency_api.rb', line 257

def v1_list_currencies(opts = {})
  data, _status_code, _headers = v1_list_currencies_with_http_info(opts)
  data
end

#v1_list_currencies_with_http_info(opts = {}) ⇒ Array<(ListCurrenciesOut, Integer, Hash)>

Get list of all currencies

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :code (Array<String>)

    code - currency code ISO 4217

  • :expand (Array<String>)

    expand - expand properties

  • :exclude (Array<String>)

    exclude - exclude properties

  • :language (String)

    language - localisation language

  • :type (String)

    type - type of currency

  • :sort (Array<String>)

    sort - sort properties

  • :page (String)

    page - page number

  • :page_size (String)

    pageSize - page size

Returns:

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

    ListCurrenciesOut data, response status code and response headers



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
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/devme-sdk-ruby/api/currency_api.rb', line 273

def v1_list_currencies_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CurrencyApi.v1_list_currencies ...'
  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
  allowable_values = ["fiat", "crypto"]
  if @api_client.config.client_side_validation && opts[:'type'] && !allowable_values.include?(opts[:'type'])
    fail ArgumentError, "invalid value for \"type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1-list-currencies'

  # 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[:'type'] = opts[:'type'] if !opts[:'type'].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] || 'ListCurrenciesOut'

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

  new_options = opts.merge(
    :operation => :"CurrencyApi.v1_list_currencies",
    :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: CurrencyApi#v1_list_currencies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end