Class: NSConnector::Invoice

Inherits:
Resource show all
Defined in:
lib/ns_connector/resources/invoice.rb

Overview

  • time

Instance Attribute Summary

Attributes inherited from Resource

#store

Instance Method Summary collapse

Methods inherited from Resource

advanced_search, all, #attach!, #check_id10t_errors!, #delete!, delete!, #detach!, #fields, find, find_by, #in_netsuite?, #initialize, #inspect, raw_search, #save!, search_by, #sublists, #transform!, #type_id

Methods included from ChunkedSearching

#grab_chunk, #normal_search_by_chunks, #search_by_chunks, #threaded_search_by_chunks

Methods included from Attaching

#attach!, #detach!

Methods included from Transforming

#transform!

Methods included from FieldStore

#create_store_accessors!

Constructor Details

This class inherits a constructor from NSConnector::Resource

Instance Method Details

#to_pdfObject

Convert ourself to PDF

Returns

A long string with the PDF data



454
455
456
457
458
459
460
461
462
463
464
465
# File 'lib/ns_connector/resources/invoice.rb', line 454

def to_pdf
	unless id then raise ::ArgumentError,
		'Could not find id for this Invoice, are you trying '\
		'to convert an invoice to PDF without creating it?'
	end

	encoded = NSConnector::Restlet.execute!(
		:action => 'invoice_pdf',
		:invoice_id => id
	).first
	Base64::decode64(encoded)
end