Class: Straight::ExchangeRate::BitpayAdapter
- Defined in:
- lib/straight/exchange_rate_adapters/bitpay_adapter.rb
Constant Summary collapse
- FETCH_URL =
'https://bitpay.com/api/rates'
Instance Method Summary collapse
Methods inherited from Adapter
#convert_from_currency, #convert_to_currency, #fetch_rates!, #get_rate_value_from_hash, #initialize, #rate_to_f
Constructor Details
This class inherits a constructor from Straight::ExchangeRate::Adapter
Instance Method Details
#rate_for(currency_code) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/straight/exchange_rate_adapters/bitpay_adapter.rb', line 8 def rate_for(currency_code) super @rates.each do |rt| if rt['code'] == currency_code rate = get_rate_value_from_hash(rt, 'rate') return rate_to_f(rate) end end raise CurrencyNotSupported end |