Class: Xeroizer::Report::Factory
- Inherits:
-
Object
- Object
- Xeroizer::Report::Factory
- Includes:
- ApplicationHttpProxy
- Defined in:
- lib/xeroizer/report/factory.rb
Instance Attribute Summary collapse
-
#application ⇒ Object
readonly
Returns the value of attribute application.
-
#report_type ⇒ Object
readonly
Returns the value of attribute report_type.
Instance Method Summary collapse
- #api_controller_name ⇒ Object
-
#get(options = {}) ⇒ Object
Retreive a report with the ‘options` as a hash containing valid query-string parameters to pass to the API.
-
#initialize(application, report_type) ⇒ Factory
constructor
A new instance of Factory.
- #klass ⇒ Object
Methods included from ApplicationHttpProxy
Constructor Details
#initialize(application, report_type) ⇒ Factory
Returns a new instance of Factory.
16 17 18 19 |
# File 'lib/xeroizer/report/factory.rb', line 16 def initialize(application, report_type) @application = application @report_type = report_type end |
Instance Attribute Details
#application ⇒ Object (readonly)
Returns the value of attribute application.
11 12 13 |
# File 'lib/xeroizer/report/factory.rb', line 11 def application @application end |
#report_type ⇒ Object (readonly)
Returns the value of attribute report_type.
12 13 14 |
# File 'lib/xeroizer/report/factory.rb', line 12 def report_type @report_type end |
Instance Method Details
#api_controller_name ⇒ Object
31 32 33 |
# File 'lib/xeroizer/report/factory.rb', line 31 def api_controller_name "Reports/#{report_type}" end |
#get(options = {}) ⇒ Object
Retreive a report with the ‘options` as a hash containing valid query-string parameters to pass to the API.
23 24 25 26 27 28 29 |
# File 'lib/xeroizer/report/factory.rb', line 23 def get( = {}) response_xml = [:cache_file] ? File.read([:cache_file]) : http_get() response = Response.parse(response_xml, ) do | response, elements | parse_reports(response, elements) end response.response_items.first # there is is only one end |