class EasyInvoice::Invoice
Public Instance Methods
generate_pdf()
click to toggle source
# File lib/easy_invoice/invoice.rb, line 32 def generate_pdf response = Excon.post(BASE_URL, body: self.payload.to_s, headers: {"Content-Type" => "application/json"}) if response.status == 200 self.pdf = response.body return true else return false end end
payload()
click to toggle source
# File lib/easy_invoice/invoice.rb, line 42 def payload payload = self.attributes.select { |k,v| v.is_a?(String) || v.is_a?(Integer) } payload[:items] = self.items.map { |item| item.attributes} unless self.template.nil? template_attributes = self.template.attributes payload.merge(template_attributes) end #Add any extra options payload = payload.merge(self.options) payload.to_json end