Module: YahooStocks::Quotes

Extended by:
Http
Includes:
Endpoint
Defined in:
lib/yahoo_stocks/quotes.rb

Constant Summary collapse

BACKEND =
YahooStocks::Backend::Array

Constants included from Endpoint

Endpoint::ENDPOINT, Endpoint::FORMAT

Constants included from Endpoint::Tags

Endpoint::Tags::TAGS

Class Method Summary collapse

Methods included from Http

http_get

Methods included from Endpoint

compose_quotes

Class Method Details

.get(symbols, format = nil) ⇒ Object



14
15
16
17
18
# File 'lib/yahoo_stocks/quotes.rb', line 14

def self.get(symbols, format = nil)
  uri = YahooStocks::Endpoint.compose_quotes(symbols, format)
  response = http_get(uri)
  BACKEND.new.produce(response)
end

.method_missing(symbol, format = nil) ⇒ Object



20
21
22
23
24
25
# File 'lib/yahoo_stocks/quotes.rb', line 20

def self.method_missing(symbol, format = nil)
  # http://yehudakatz.com/2010/01/02/the-craziest-fing-bug-ive-ever-seen/
  # http://stackoverflow.com/questions/8960685/ruby-why-does-puts-call-to-ary
  super if symbol == :to_ary
  get([symbol], format)
end