Class: CloudmersiveCurrencyApiClient::CurrencyExchangeApi
- Inherits:
-
Object
- Object
- CloudmersiveCurrencyApiClient::CurrencyExchangeApi
- Defined in:
- lib/cloudmersive-currency-api-client/api/currency_exchange_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#currency_exchange_convert_currency(source, destination, source_price, opts = {}) ⇒ ConvertedCurrencyResult
Converts a price from the source currency into the destination currency Automatically converts the price in the source currency into the destination currency using the latest available currency exchange rate data.
-
#currency_exchange_convert_currency_with_http_info(source, destination, source_price, opts = {}) ⇒ Array<(ConvertedCurrencyResult, Fixnum, Hash)>
Converts a price from the source currency into the destination currency Automatically converts the price in the source currency into the destination currency using the latest available currency exchange rate data.
-
#currency_exchange_get_available_currencies(opts = {}) ⇒ AvailableCurrencyResponse
Get a list of available currencies and corresponding countries Enumerates available currencies and the countries that correspond to these currencies.
-
#currency_exchange_get_available_currencies_with_http_info(opts = {}) ⇒ Array<(AvailableCurrencyResponse, Fixnum, Hash)>
Get a list of available currencies and corresponding countries Enumerates available currencies and the countries that correspond to these currencies.
-
#currency_exchange_get_exchange_rate(source, destination, opts = {}) ⇒ ExchangeRateResult
Gets the exchange rate from the source currency into the destination currency Automatically gets the exchange rate from the source currency into the destination currency using the latest available currency exchange rate data.
-
#currency_exchange_get_exchange_rate_with_http_info(source, destination, opts = {}) ⇒ Array<(ExchangeRateResult, Fixnum, Hash)>
Gets the exchange rate from the source currency into the destination currency Automatically gets the exchange rate from the source currency into the destination currency using the latest available currency exchange rate data.
-
#initialize(api_client = ApiClient.default) ⇒ CurrencyExchangeApi
constructor
A new instance of CurrencyExchangeApi.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ CurrencyExchangeApi
Returns a new instance of CurrencyExchangeApi.
19 20 21 |
# File 'lib/cloudmersive-currency-api-client/api/currency_exchange_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/cloudmersive-currency-api-client/api/currency_exchange_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#currency_exchange_convert_currency(source, destination, source_price, opts = {}) ⇒ ConvertedCurrencyResult
Converts a price from the source currency into the destination currency Automatically converts the price in the source currency into the destination currency using the latest available currency exchange rate data.
29 30 31 32 |
# File 'lib/cloudmersive-currency-api-client/api/currency_exchange_api.rb', line 29 def currency_exchange_convert_currency(source, destination, source_price, opts = {}) data, _status_code, _headers = currency_exchange_convert_currency_with_http_info(source, destination, source_price, opts) data end |
#currency_exchange_convert_currency_with_http_info(source, destination, source_price, opts = {}) ⇒ Array<(ConvertedCurrencyResult, Fixnum, Hash)>
Converts a price from the source currency into the destination currency Automatically converts the price in the source currency into the destination currency using the latest available currency exchange rate data.
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 |
# File 'lib/cloudmersive-currency-api-client/api/currency_exchange_api.rb', line 41 def currency_exchange_convert_currency_with_http_info(source, destination, source_price, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CurrencyExchangeApi.currency_exchange_convert_currency ...' end # verify the required parameter 'source' is set if @api_client.config.client_side_validation && source.nil? fail ArgumentError, "Missing the required parameter 'source' when calling CurrencyExchangeApi.currency_exchange_convert_currency" end # verify the required parameter 'destination' is set if @api_client.config.client_side_validation && destination.nil? fail ArgumentError, "Missing the required parameter 'destination' when calling CurrencyExchangeApi.currency_exchange_convert_currency" end # verify the required parameter 'source_price' is set if @api_client.config.client_side_validation && source_price.nil? fail ArgumentError, "Missing the required parameter 'source_price' when calling CurrencyExchangeApi.currency_exchange_convert_currency" end # resource path local_var_path = '/currency/exchange-rates/convert/{source}/to/{destination}'.sub('{' + 'source' + '}', source.to_s).sub('{' + 'destination' + '}', destination.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(source_price) auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ConvertedCurrencyResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: CurrencyExchangeApi#currency_exchange_convert_currency\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#currency_exchange_get_available_currencies(opts = {}) ⇒ AvailableCurrencyResponse
Get a list of available currencies and corresponding countries Enumerates available currencies and the countries that correspond to these currencies.
92 93 94 95 |
# File 'lib/cloudmersive-currency-api-client/api/currency_exchange_api.rb', line 92 def currency_exchange_get_available_currencies(opts = {}) data, _status_code, _headers = currency_exchange_get_available_currencies_with_http_info(opts) data end |
#currency_exchange_get_available_currencies_with_http_info(opts = {}) ⇒ Array<(AvailableCurrencyResponse, Fixnum, Hash)>
Get a list of available currencies and corresponding countries Enumerates available currencies and the countries that correspond to these currencies.
101 102 103 104 105 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 |
# File 'lib/cloudmersive-currency-api-client/api/currency_exchange_api.rb', line 101 def currency_exchange_get_available_currencies_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CurrencyExchangeApi.currency_exchange_get_available_currencies ...' end # resource path local_var_path = '/currency/exchange-rates/list-available' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'AvailableCurrencyResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CurrencyExchangeApi#currency_exchange_get_available_currencies\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#currency_exchange_get_exchange_rate(source, destination, opts = {}) ⇒ ExchangeRateResult
Gets the exchange rate from the source currency into the destination currency Automatically gets the exchange rate from the source currency into the destination currency using the latest available currency exchange rate data.
140 141 142 143 |
# File 'lib/cloudmersive-currency-api-client/api/currency_exchange_api.rb', line 140 def currency_exchange_get_exchange_rate(source, destination, opts = {}) data, _status_code, _headers = currency_exchange_get_exchange_rate_with_http_info(source, destination, opts) data end |
#currency_exchange_get_exchange_rate_with_http_info(source, destination, opts = {}) ⇒ Array<(ExchangeRateResult, Fixnum, Hash)>
Gets the exchange rate from the source currency into the destination currency Automatically gets the exchange rate from the source currency into the destination currency using the latest available currency exchange rate data.
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 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/cloudmersive-currency-api-client/api/currency_exchange_api.rb', line 151 def currency_exchange_get_exchange_rate_with_http_info(source, destination, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: CurrencyExchangeApi.currency_exchange_get_exchange_rate ...' end # verify the required parameter 'source' is set if @api_client.config.client_side_validation && source.nil? fail ArgumentError, "Missing the required parameter 'source' when calling CurrencyExchangeApi.currency_exchange_get_exchange_rate" end # verify the required parameter 'destination' is set if @api_client.config.client_side_validation && destination.nil? fail ArgumentError, "Missing the required parameter 'destination' when calling CurrencyExchangeApi.currency_exchange_get_exchange_rate" end # resource path local_var_path = '/currency/exchange-rates/get/{source}/to/{destination}'.sub('{' + 'source' + '}', source.to_s).sub('{' + 'destination' + '}', destination.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/json', 'application/xml', 'text/xml']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ExchangeRateResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: CurrencyExchangeApi#currency_exchange_get_exchange_rate\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |