class Jortt::Client::Invoices

Exposes the operations available for a collection of invoices.

@see { Jortt::Client.invoices }

Attributes

client[RW]

Public Class Methods

new(client) click to toggle source
# File lib/jortt/client/invoices.rb, line 10
def initialize(client)
  @client = client
end

Public Instance Methods

create(payload) click to toggle source

Creates an Invoice using the POST /invoices endpoint. developer.jortt.nl/#create-and-optionally-send-an-invoice

@example

client.invoices.create(
  line_items: [{
    vat_percentage: "21.0",
    amount: 499,
    number_of_units: "4",
    description: 'Your product'
  }]
)
# File lib/jortt/client/invoices.rb, line 49
def create(payload)
  client.post('/invoices', payload)
end
credit(id, payload) click to toggle source

Credits an Invoice using the POST /invoices/{invoice_id}/credit endpoint. developer.jortt.nl/#create-and-optionally-send-an-invoice

@example

client.invoices.credit(
  "9afcd96e-caf8-40a1-96c9-1af16d0bc804",
  {
    send_method: 'email'
  }
)
# File lib/jortt/client/invoices.rb, line 64
def credit(id, payload)
  client.post("/invoices/#{id}/credit", payload)
end
download(id) click to toggle source

Returns an invoice PDF download link using the GET /invoices/{invoice_id}/download endpoint. developer.jortt.nl/#download-invoice-pdf

@example

client.invoices.download("9afcd96e-caf8-40a1-96c9-1af16d0bc804")
# File lib/jortt/client/invoices.rb, line 75
def download(id)
  client.get("/invoices/#{id}/download")
end
index(query: nil, invoice_status: nil) click to toggle source

Returns all invoices using the GET /invoices endpoint. developer.jortt.nl/#list-invoices

@example

client.invoices.index(query: 'Jane')
# File lib/jortt/client/invoices.rb, line 21
def index(query: nil, invoice_status: nil)
  client.paginated('/invoices', query: query, invoice_status: invoice_status)
end
show(id) click to toggle source

Returns a invoice using the GET /invoices/{invoice_id} endpoint. developer.jortt.nl/#get-invoice-by-id

@example

client.invoices.show("9afcd96e-caf8-40a1-96c9-1af16d0bc804")
# File lib/jortt/client/invoices.rb, line 32
def show(id)
  client.get("/invoices/#{id}")
end