class Xeroizer::Record::CreditNoteModel

Public Instance Methods

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

Retrieve the PDF version of the credit 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/credit_note.rb, line 15
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