Class: Quickbooks::Model::Report
- Defined in:
- lib/quickbooks/model/report.rb
Instance Attribute Summary collapse
-
#xml ⇒ Object
Returns the value of attribute xml.
Instance Method Summary collapse
Methods inherited from BaseModel
#as_json, attribute_names, #attributes, attrs_with_types, #initialize, inspect, #inspect, reference_attrs, reference_setters, resource_for_collection, resource_for_singular, to_xml_big_decimal, #to_xml_inject_ns, #to_xml_ns
Methods included from Validator
Methods included from Definition
included, #is_name_list_entity?, #is_transaction_entity?
Constructor Details
This class inherits a constructor from Quickbooks::Model::BaseModel
Instance Attribute Details
#xml ⇒ Object
Returns the value of attribute xml.
5 6 7 |
# File 'lib/quickbooks/model/report.rb', line 5 def xml @xml end |
Instance Method Details
#all_rows ⇒ Object
7 8 9 |
# File 'lib/quickbooks/model/report.rb', line 7 def all_rows @all_rows ||= xml.css("ColData:first-child").map {|node| parse_row(node.parent) } end |
#columns ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/quickbooks/model/report.rb', line 11 def columns @columns ||= begin nodes = xml.css('Column') nodes.map do |node| # There is also a ColType field, but it does not seem valuable to capture node.at('ColTitle').content end end end |
#find_row(label) ⇒ Object
21 22 23 |
# File 'lib/quickbooks/model/report.rb', line 21 def find_row(label) all_rows.find {|r| r[0] == label } end |