Convert a USD Price to EUR in Ruby

gem 'cloudmersive-currency-api-client', '~> 1.7.8'
# load the gem
require 'cloudmersive-currency-api-client'
# setup authorization
CloudmersiveCurrencyApiClient.configure do |config|
# Configure API key authorization: Apikey
config.api_key['Apikey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['Apikey'] = 'Bearer'
end
api_instance = CloudmersiveCurrencyApiClient::CurrencyExchangeApi.newsource = 'source_example' # String | Source currency three-digit code (ISO 4217), e.g. USD, EUR, etc.destination = 'destination_example' # String | Destination currency three-digit code (ISO 4217), e.g. USD, EUR, etc.source_price = 1.2 # Float | Input price, such as 19.99 in source currencybegin
#Converts a price from the source currency into the destination currency
result = api_instance.currency_exchange_convert_currency(source, destination, source_price)
p result
rescue CloudmersiveCurrencyApiClient::ApiError => e
puts "Exception when calling CurrencyExchangeApi->currency_exchange_convert_currency: #{e}"
end

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store