Class: Moneybags::YahooCurrencyService

Inherits:
Object
  • Object
show all
Extended by:
RemoteService
Defined in:
lib/moneybags.rb

Class Method Summary collapse

Methods included from RemoteService

initialize, make_request

Class Method Details

.lookup(from, to) ⇒ Object

Raises:



26
27
28
29
30
31
# File 'lib/moneybags.rb', line 26

def lookup(from, to)
  rate = make_request("http://download.finance.yahoo.com/d/quotes.csv?s=#{from}#{to}=X&f=l1&e=.csv").strip.chomp.to_f
  raise MissingRateError, "response: #{rate}, from: #{from}, to: #{to}" if rate == 0.0
  
  rate
end