class CryptoVal::FiatExchange
Constants
- DEFAULT_CURRENCY
Public Class Methods
fetch(opts={})
click to toggle source
# File lib/crypto_val/fiat_exchange.rb, line 20 def self.fetch opts={} new(opts).fetch end
new(opts={})
click to toggle source
# 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
Public Instance Methods
fetch()
click to toggle source
# 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
Private Instance Methods
exchange()
click to toggle source
# File lib/crypto_val/fiat_exchange.rb, line 26 def exchange @exchange ||= @exchange_klass.fetch({ source_currency: @source_currency, target_currency: @target_currency }) end