Class: IRXML::Stock::HistoricQuote
- Inherits:
-
Object
- Object
- IRXML::Stock::HistoricQuote
- Defined in:
- lib/irxml/stock.rb
Instance Method Summary collapse
- #attributes ⇒ Object
- #get(lookupdate, ticker) ⇒ Object
-
#initialize(lookupdate, ticker = IRXML.company_id) ⇒ HistoricQuote
constructor
A new instance of HistoricQuote.
- #set_values ⇒ Object
Constructor Details
#initialize(lookupdate, ticker = IRXML.company_id) ⇒ HistoricQuote
Returns a new instance of HistoricQuote.
28 29 30 31 |
# File 'lib/irxml/stock.rb', line 28 def initialize(lookupdate, ticker = IRXML.company_id) get(lookupdate, ticker) set_values end |
Instance Method Details
#attributes ⇒ Object
38 39 40 |
# File 'lib/irxml/stock.rb', line 38 def attributes @attributes ||= {} end |
#get(lookupdate, ticker) ⇒ Object
33 34 35 36 |
# File 'lib/irxml/stock.rb', line 33 def get(lookupdate, ticker) lookupdate = CGI::escape(lookupdate.strftime("%m/%d/%Y")) @data = IRXML.get('HistoricStockQuote', {'TICKER' => ticker, 'LOOKUPDATE' => lookupdate}) end |
#set_values ⇒ Object
42 43 44 45 46 47 |
# File 'lib/irxml/stock.rb', line 42 def set_values @data.css('ROW').children.each do |node| attributes[node.name.downcase] = node.content self.class.class_eval { define_method(node.name.downcase) { attributes[node.name.downcase] } } end end |