Class: CryptoVal::FiatExchange::Fixer

Inherits:
Object
  • Object
show all
Defined in:
lib/crypto_val/fiat_exchange/fixer.rb

Constant Summary collapse

DEFAULT_SOURCE =
"USD"
DEFAULT_TARGET =
"PHP"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Fixer

Returns a new instance of Fixer.



8
9
10
11
# File 'lib/crypto_val/fiat_exchange/fixer.rb', line 8

def initialize opts={}
  @source_currency = opts[:source_currency] || DEFAULT_SOURCE
  @target_currency = opts[:target_currency] || DEFAULT_TARGET
end

Instance Attribute Details

#source_currencyObject (readonly)

Returns the value of attribute source_currency.



6
7
8
# File 'lib/crypto_val/fiat_exchange/fixer.rb', line 6

def source_currency
  @source_currency
end

#target_currencyObject (readonly)

Returns the value of attribute target_currency.



6
7
8
# File 'lib/crypto_val/fiat_exchange/fixer.rb', line 6

def target_currency
  @target_currency
end

Class Method Details

.fetch(opts = {}) ⇒ Object



17
18
19
# File 'lib/crypto_val/fiat_exchange/fixer.rb', line 17

def self.fetch opts={}
  new(opts).fetch
end

Instance Method Details

#fetchObject



13
14
15
# File 'lib/crypto_val/fiat_exchange/fixer.rb', line 13

def fetch
  format_response
end