class Billomat::Models::Invoice

Representation of the invoice resource

Public Class Methods

base_path() click to toggle source

@return [String] The resource's base path

# File lib/billomat/models/invoice.rb, line 9
def self.base_path
  '/invoices'
end
resource_name() click to toggle source

@return [String] The resource's name

# File lib/billomat/models/invoice.rb, line 14
def self.resource_name
  'invoice'
end

Public Instance Methods

cancel!() click to toggle source

Cancels the invoice by calling the Cancel action

# File lib/billomat/models/invoice.rb, line 26
def cancel!
  Billomat::Actions::Cancel.new(id).call
end
complete!() click to toggle source

Completes the invoice by calling the Complete action

# File lib/billomat/models/invoice.rb, line 20
def complete!
  Billomat::Actions::Complete.new(id).call
end
send_email(recipient) click to toggle source

Sends the invoice as an email to the given recipient

@param [String] recipient The email address of the recipient

# File lib/billomat/models/invoice.rb, line 34
def send_email(recipient)
  email_params = { recipients: { to: recipient } }

  Billomat::Actions::Email.new(id, email_params).call
end
to_pdf() click to toggle source

Allows to download the invoice as an PDF

# File lib/billomat/models/invoice.rb, line 42
def to_pdf
  Billomat::Actions::Pdf.new(id).call
end