Class: Quickbooks::Service::Reports

Inherits:
BaseService show all
Defined in:
lib/quickbooks/service/reports.rb

Constant Summary

Constants inherited from BaseService

BaseService::BASE_DOMAIN, BaseService::HTTP_ACCEPT, BaseService::HTTP_ACCEPT_ENCODING, BaseService::HTTP_CONTENT_TYPE, BaseService::SANDBOX_DOMAIN, BaseService::XML_NS

Instance Attribute Summary

Attributes inherited from BaseService

#base_uri, #company_id, #last_response_body, #last_response_xml, #oauth

Instance Method Summary collapse

Methods inherited from BaseService

#access_token=, #default_model_query, #initialize, #is_json?, #is_pdf?, #realm_id=, #url_for_base, #url_for_resource

Methods included from ServiceCrud

#all, #create, #delete, #delete_by_query_string, #fetch_by_id, #find_by, #query_in_batches

Methods included from Util::Logging

#log, #log?, #log_xml

Constructor Details

This class inherits a constructor from Quickbooks::Service::BaseService

Instance Method Details

#query(object_query = 'BalanceSheet', date_macro = 'This Fiscal Year-to-date', options = {}) ⇒ Object



20
21
22
23
# File 'lib/quickbooks/service/reports.rb', line 20

def query(object_query = 'BalanceSheet', date_macro = 'This Fiscal Year-to-date', options = {})
  do_http_get(url_for_query(object_query, date_macro, options))
  model.new(:xml => @last_response_xml)
end

#url_for_query(which_report = 'BalanceSheet', date_macro = 'This Fiscal Year-to-date', options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/quickbooks/service/reports.rb', line 6

def url_for_query(which_report = 'BalanceSheet', date_macro = 'This Fiscal Year-to-date', options = {})
  if(options == {})
    return "#{url_for_base}/reports/#{which_report}?date_macro=#{URI.encode_www_form_component(date_macro)}"
  else
    options_string = ""
    options.each do |key, value|
      options_string += "#{key}=#{value}&"
    end
    options_string = options_string[0..-2]
    options_string.gsub!(/\s/,"%20")
    return "#{url_for_base}/reports/#{which_report}?#{options_string}"
  end
end