cloudmersive-currency-api-client
CloudmersiveCurrencyApiClient - the Ruby gem for the currencyapi
The currency APIs help you retrieve exchange rates and convert prices between currencies easily.
This SDK is automatically generated by the Swagger Codegen project:
- API version: v1
- Package version: 2.0.1
- Build package: io.swagger.codegen.languages.RubyClientCodegen
Installation
Build a gem
To build the Ruby code into a gem:
gem build cloudmersive-currency-api-client.gemspec
Then either install the gem locally:
gem install ./cloudmersive-currency-api-client-2.0.1.gem
(for development, run gem install --dev ./cloudmersive-currency-api-client-2.0.1.gem
to install the development dependencies)
or publish the gem to a gem hosting service, e.g. RubyGems.
Finally add this to the Gemfile:
gem 'cloudmersive-currency-api-client', '~> 2.0.1'
Install from Git
If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:
gem 'cloudmersive-currency-api-client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'
Include the Ruby code directly
Include the Ruby code directly using -I
as follows:
ruby -Ilib script.rb
Getting Started
Please follow the installation procedure and then run the following code:
# 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.new
source = '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 currency
begin
#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
Documentation for API Endpoints
All URIs are relative to https://api.cloudmersive.com
Class | Method | HTTP request | Description |
---|---|---|---|
CloudmersiveCurrencyApiClient::CurrencyExchangeApi | currency_exchange_convert_currency | POST /currency/exchange-rates/convert/source/to/destination | Converts a price from the source currency into the destination currency |
CloudmersiveCurrencyApiClient::CurrencyExchangeApi | currency_exchange_get_available_currencies | POST /currency/exchange-rates/list-available | Get a list of available currencies and corresponding countries |
CloudmersiveCurrencyApiClient::CurrencyExchangeApi | currency_exchange_get_exchange_rate | POST /currency/exchange-rates/get/source/to/destination | Gets the exchange rate from the source currency into the destination currency |
Documentation for Models
- CloudmersiveCurrencyApiClient::AvailableCurrency
- CloudmersiveCurrencyApiClient::AvailableCurrencyResponse
- CloudmersiveCurrencyApiClient::ConvertedCurrencyResult
- CloudmersiveCurrencyApiClient::ExchangeRateResult
Documentation for Authorization
Apikey
- Type: API key
- API key parameter name: Apikey
- Location: HTTP header