Class: XeroGateway::Report
- Inherits:
-
Object
- Object
- XeroGateway::Report
- Defined in:
- lib/xero_gateway/report.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#column_names ⇒ Object
Returns the value of attribute column_names.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#report_date ⇒ Object
Returns the value of attribute report_date.
-
#report_id ⇒ Object
Returns the value of attribute report_id.
-
#report_name ⇒ Object
Returns the value of attribute report_name.
-
#report_titles ⇒ Object
Returns the value of attribute report_titles.
-
#report_type ⇒ Object
Returns the value of attribute report_type.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Report
constructor
A new instance of Report.
Methods included from Dates
Methods included from Money
Constructor Details
#initialize(params = {}) ⇒ Report
Returns a new instance of Report.
10 11 12 13 14 15 16 17 18 |
# File 'lib/xero_gateway/report.rb', line 10 def initialize(params={}) @errors ||= [] @report_titles ||= [] @body ||= [] params.each do |k,v| self.send("#{k}=", v) end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
7 8 9 |
# File 'lib/xero_gateway/report.rb', line 7 def body @body end |
#column_names ⇒ Object
Returns the value of attribute column_names.
7 8 9 |
# File 'lib/xero_gateway/report.rb', line 7 def column_names @column_names end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
6 7 8 |
# File 'lib/xero_gateway/report.rb', line 6 def errors @errors end |
#report_date ⇒ Object
Returns the value of attribute report_date.
7 8 9 |
# File 'lib/xero_gateway/report.rb', line 7 def report_date @report_date end |
#report_id ⇒ Object
Returns the value of attribute report_id.
7 8 9 |
# File 'lib/xero_gateway/report.rb', line 7 def report_id @report_id end |
#report_name ⇒ Object
Returns the value of attribute report_name.
7 8 9 |
# File 'lib/xero_gateway/report.rb', line 7 def report_name @report_name end |
#report_titles ⇒ Object
Returns the value of attribute report_titles.
7 8 9 |
# File 'lib/xero_gateway/report.rb', line 7 def report_titles @report_titles end |
#report_type ⇒ Object
Returns the value of attribute report_type.
7 8 9 |
# File 'lib/xero_gateway/report.rb', line 7 def report_type @report_type end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
7 8 9 |
# File 'lib/xero_gateway/report.rb', line 7 def updated_at @updated_at end |
Class Method Details
.from_xml(report_element) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/xero_gateway/report.rb', line 20 def self.from_xml(report_element) report = Report.new report_element.children.each do | element | case element.name when 'ReportID' then report.report_id = element.text when 'ReportName' then report.report_name = element.text when 'ReportType' then report.report_type = element.text when 'ReportTitles' each_title(element) do |title| report.report_titles << title end when 'ReportDate' then report.report_date = Date.parse(element.text) when 'UpdatedDateUTC' then report.updated_at = parse_date_time_utc(element.text) when 'Rows' report.column_names ||= find_body_column_names(element) each_row_content(element) do |content_hash| report.body << OpenStruct.new(content_hash) end end end report end |