class BloomRemit2::Rate
Public Class Methods
list()
click to toggle source
Returns a real-time hash of currency exchange rates that update every minute
Supported currencies include: AED, AUD, BCH, BTC, CAD, CNY, DASH, ETH, EUR, GBP, HKD, IDR, INR, JPY, KRW, LINK, LTC, MYR, NPR, PHP, SGD, THB, USD, USDT, VND, XLM, XRP, ZAR. By default, all rates provided are relative to USD.
@return currency_exchange_rates [Hash] where key is 6-letter currency pair and value is price
# File lib/bloom_remit2/rate.rb, line 11 def list rates = Client.get(path) JSON.parse(rates.body) end
retrieve(currency_pair)
click to toggle source
Retrieves one currency exchange rate @param currency_pair [String] 6-letter currency pair (e.g. 'USDBTC') @return rate [BloomRemit2::Rate]
# File lib/bloom_remit2/rate.rb, line 19 def retrieve(currency_pair) price = Client.get("#{path}¤cy=#{currency_pair}").body { currency_pair => price.to_f } end
Private Class Methods
path()
click to toggle source
# File lib/bloom_remit2/rate.rb, line 26 def path "api/v1/rates?partner_id=#{BloomRemit2.configuration.api_token}" end