module CurrentPrice::Yahoo::Client::Quote
Public Instance Methods
quote(ticker)
click to toggle source
# File lib/current-price/yahoo/client/quote.rb, line 6 def quote(ticker) url = 'https://query.yahooapis.com/v1/public/yql?q=' url += URI.encode("SELECT * FROM yahoo.finance.quotes WHERE symbol IN ('#{ticker}')") url += '&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=' quote_serializer( request( url ) ) end
Private Instance Methods
quote_serializer(data)
click to toggle source
# File lib/current-price/yahoo/client/quote.rb, line 19 def quote_serializer(data) Hash[ JSON.parse(data).fetch('query')['results']['quote'].map{ |key, val| [underscore(key).to_sym, val] } ] end