class Xeroizer::Record::InvoiceModel

Public Instance Methods

pdf(id, filename = nil) click to toggle source

Retrieve the PDF version of the invoice matching the `id`. @param [String] id invoice's ID. @param [String] filename optional filename to store the PDF in instead of returning the data.

# File lib/xeroizer/models/invoice.rb, line 25
def pdf(id, filename = nil)
  pdf_data = @application.http_get(@application.client, "#{url}/#{CGI.escape(id)}", :response => :pdf)
  if filename
    File.open(filename, "wb") { | fp | fp.write pdf_data }
    nil
  else
    pdf_data
  end
end