Class: CryptoVal::FiatExchange
- Inherits:
-
Object
- Object
- CryptoVal::FiatExchange
- Defined in:
- lib/crypto_val/fiat_exchange.rb
Defined Under Namespace
Classes: Fixer
Constant Summary collapse
- DEFAULT_CURRENCY =
"USD"
Class Method Summary collapse
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(opts = {}) ⇒ FiatExchange
constructor
A new instance of FiatExchange.
Constructor Details
#initialize(opts = {}) ⇒ FiatExchange
Returns a new instance of FiatExchange.
5 6 7 8 9 |
# File 'lib/crypto_val/fiat_exchange.rb', line 5 def initialize opts={} @source_currency = opts[:source_currency] || DEFAULT_CURRENCY @target_currency = opts[:target_currency] @exchange_klass = opts[:exchange_class] || CryptoVal::FiatExchange::Fixer end |
Class Method Details
.fetch(opts = {}) ⇒ Object
20 21 22 |
# File 'lib/crypto_val/fiat_exchange.rb', line 20 def self.fetch opts={} new(opts).fetch end |
Instance Method Details
#fetch ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/crypto_val/fiat_exchange.rb', line 11 def fetch { source_currency: exchange[:source], target_currency: exchange[:target], date: exchange[:date], rate: exchange[:rate] } end |