Class: Straight::ExchangeRate::BtceAdapter

Inherits:
Adapter
  • Object
show all
Defined in:
lib/straight/exchange_rate_adapters/btce_adapter.rb

Constant Summary collapse

FETCH_URL =
'https://btc-e.com/api/2/btc_usd/ticker'

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
# File 'lib/straight/exchange_rate_adapters/btce_adapter.rb', line 8

def rate_for(currency_code)
  super
  raise CurrencyNotSupported if !FETCH_URL.include?("btc_#{currency_code.downcase}")
  rate = get_rate_value_from_hash(@rates, 'ticker', 'last')
  rate_to_f(rate)
end