Class: Xeroizer::Record::InvoiceModel
- Defined in:
- lib/xeroizer/models/invoice.rb
Constant Summary
Constants inherited from BaseModel
BaseModel::ALLOWED_PERMISSIONS, BaseModel::DEFAULT_RECORDS_PER_BATCH_SAVE
Instance Attribute Summary
Attributes inherited from BaseModel
#application, #model_class, #model_name, #response
Instance Method Summary collapse
-
#pdf(id, filename = nil) ⇒ Object
Retrieve the PDF version of the invoice matching the ‘id`.
Methods inherited from BaseModel
#all, #api_controller_name, #batch_save, #build, #create, #find, #first, #initialize, #mark_clean, #mark_dirty, #parse_response, set_api_controller_name, set_optional_xml_root_name, set_permissions, set_xml_node_name, set_xml_root_name
Methods included from BaseModelHttpProxy
Methods included from ClassLevelInheritableAttributes
Constructor Details
This class inherits a constructor from Xeroizer::Record::BaseModel
Instance Method Details
#pdf(id, filename = nil) ⇒ Object
Retrieve the PDF version of the invoice matching the ‘id`.
16 17 18 19 20 21 22 23 24 |
# File 'lib/xeroizer/models/invoice.rb', line 16 def pdf(id, filename = nil) pdf_data = @application.http_get(@application.client, "#{url}/#{CGI.escape(id)}", :response => :pdf) if filename File.open(filename, "w") { | fp | fp.write pdf_data } nil else pdf_data end end |