Class: CryptoVal::Latest
- Inherits:
-
Object
- Object
- CryptoVal::Latest
- Defined in:
- lib/crypto_val/latest.rb
Constant Summary collapse
- DEFAULT_CRYPTO =
Gets the latest value of a cryptocurrency
"BTC"- DEFAULT_CURRENCY =
"USD"
Class Method Summary collapse
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(opts = {}) ⇒ Latest
constructor
A new instance of Latest.
Constructor Details
#initialize(opts = {}) ⇒ Latest
Returns a new instance of Latest.
7 8 9 10 11 12 |
# File 'lib/crypto_val/latest.rb', line 7 def initialize opts={} @symbol = opts[:symbol] || DEFAULT_CRYPTO @currency = opts[:currency] || DEFAULT_CURRENCY @crypto_klass = opts[:crypto_klass] || CryptoVal::CryptoExchange::Cryptonator @fiat_klass = opts[:fiat_klass] || CryptoVal::FiatExchange end |
Class Method Details
.fetch(opts = {}) ⇒ Object
22 23 24 |
# File 'lib/crypto_val/latest.rb', line 22 def self.fetch opts={} new(opts).fetch end |
Instance Method Details
#fetch ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/crypto_val/latest.rb', line 14 def fetch { symbol: @symbol, currency: @currency, value: currency_value } end |