Class: Quickeebooks::Windows::Service::Invoice

Inherits:
ServiceBase
  • Object
show all
Defined in:
lib/quickeebooks/windows/service/invoice.rb

Constant Summary

Constants inherited from ServiceBase

ServiceBase::XML_NS

Instance Attribute Summary

Attributes inherited from ServiceBase

#base_uri, #last_response_body, #last_response_xml, #oauth, #realm_id

Instance Method Summary collapse

Methods inherited from ServiceBase

#access_token=, #guid, #initialize, #url_for_base, #url_for_resource

Constructor Details

This class inherits a constructor from Quickeebooks::Windows::Service::ServiceBase

Instance Method Details

#create(invoice) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/quickeebooks/windows/service/invoice.rb', line 28

def create(invoice)
  # XML is a wrapped 'object' where the type is specified as an attribute
  #    <Object xsi:type="Invoice">
  xml_node = invoice.to_xml(:name => 'Object')
  xml_node.set_attribute('xsi:type', 'Invoice')
  xml = <<-XML
  <Add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" RequestId="#{guid}" xmlns="http://www.intuit.com/sb/cdm/v2">
  <ExternalRealmId>#{self.realm_id}</ExternalRealmId>
  #{xml_node}
  </Add>
  XML
  perform_write(Quickeebooks::Windows::Model::Invoice, xml)
end

#invoice_as_pdf(invoice_id, destination_file_name) ⇒ Object

Raises:

  • (NoMethodError)


24
25
26
# File 'lib/quickeebooks/windows/service/invoice.rb', line 24

def invoice_as_pdf(invoice_id, destination_file_name)
  raise NoMethodError, 'invoice_as_pdf is not implemented in Quickeebooks for Windows, only available in the Online adapter.'
end

#list(filters = [], page = 1, per_page = 20, sort = nil, options = {}) ⇒ Object

Fetch a Collection of Invoice objects Arguments: filters: Array of Filter objects to apply page: Fixnum Starting page per_page: Fixnum How many results to fetch per page sort: Sort object options: Hash extra arguments



20
21
22
# File 'lib/quickeebooks/windows/service/invoice.rb', line 20

def list(filters = [], page = 1, per_page = 20, sort = nil, options = {})
  fetch_collection(Quickeebooks::Windows::Model::Invoice, nil, filters, page, per_page, sort, options)
end