Class: BloomRemit2::Rate

Inherits:
Object
  • Object
show all
Defined in:
lib/bloom_remit2/rate.rb

Class Method Summary collapse

Class Method Details

.listObject

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.



11
12
13
14
# File 'lib/bloom_remit2/rate.rb', line 11

def list
  rates = Client.get(path)
  JSON.parse(rates.body)
end

.retrieve(currency_pair) ⇒ Object

Retrieves one currency exchange rate

Parameters:

  • currency_pair (String)

    6-letter currency pair (e.g. ‘USDBTC’)



19
20
21
22
# File 'lib/bloom_remit2/rate.rb', line 19

def retrieve(currency_pair)
  price = Client.get("#{path}&currency=#{currency_pair}").body
  { currency_pair => price.to_f }
end