Class: Straight::ExchangeRate::OkcoinAdapter

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

Constant Summary collapse

FETCH_URL =
'https://www.okcoin.com/api/ticker.do?ok=1'

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/okcoin_adapter.rb', line 8

def rate_for(currency_code)
  super
  raise CurrencyNotSupported if currency_code != 'USD'
  rate = get_rate_value_from_hash(@rates, 'ticker', 'last')
  rate_to_f(rate)
end