class Quickeebooks::Online::Service::Invoice
Public Instance Methods
invoice_as_pdf(invoice_id, destination_file_name)
click to toggle source
Returns the absolute path to the PDF on disk Its left to the caller to unlink the file at some later date Returns: String
: absolute path to file on disk or nil if couldn’t fetch PDF
# File lib/quickeebooks/online/service/invoice.rb, line 15 def invoice_as_pdf(invoice_id, destination_file_name) response = do_http_get("#{url_for_resource("invoice-document")}/#{invoice_id}", {}, {'Content-Type' => 'application/pdf'}) File.open(destination_file_name, "wb") do |file| file.write(response.body) end destination_file_name rescue => e log "Error downloading invoice id #{invoice_id} pdf file #{destination_file_name} with #{e}" nil end