Class: IRXML::Stock::Quote
- Inherits:
-
Object
- Object
- IRXML::Stock::Quote
- Defined in:
- lib/irxml/stock.rb
Instance Method Summary collapse
- #attributes ⇒ Object
- #get(ticker) ⇒ Object
-
#initialize(ticker = IRXML.company_id) ⇒ Quote
constructor
A new instance of Quote.
- #set_values ⇒ Object
Constructor Details
#initialize(ticker = IRXML.company_id) ⇒ Quote
Returns a new instance of Quote.
4 5 6 7 |
# File 'lib/irxml/stock.rb', line 4 def initialize(ticker = IRXML.company_id) get(ticker) set_values end |
Instance Method Details
#attributes ⇒ Object
13 14 15 |
# File 'lib/irxml/stock.rb', line 13 def attributes @attributes ||= {} end |
#get(ticker) ⇒ Object
9 10 11 |
# File 'lib/irxml/stock.rb', line 9 def get(ticker) @data = IRXML.get('StockQuote', 'TICKER' => ticker) end |
#set_values ⇒ Object
17 18 19 20 21 22 |
# File 'lib/irxml/stock.rb', line 17 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 |