class Jortt::Client::Customers

Exposes the operations available for a collection of customers.

@see { Jortt::Client.customers }

Attributes

client[RW]

Public Class Methods

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

Public Instance Methods

create(payload) click to toggle source

Creates a Customer using the POST /customers endpoint. developer.jortt.nl/#create-customer

@example

client.customers.create(
  is_private: false,
  customer_name: 'Nuka-Cola Corporation',
  address_street: 'Vault 11',
  address_postal_code: '1111AA',
  address_city: 'Mojave Wasteland'
)
# File lib/jortt/client/customers.rb, line 49
def create(payload)
  client.post('/customers', payload)
end
delete(id) click to toggle source

Deletes a Customer using the DELETE /customers/{customer_id} endpoint. developer.jortt.nl/#delete-a-customer

@example

client.customers.delete("9afcd96e-caf8-40a1-96c9-1af16d0bc804")
# File lib/jortt/client/customers.rb, line 74
def delete(id)
  client.delete("/customers/#{id}")
end
direct_debit_mandate(id) click to toggle source

Send direct debit authorization to a Customer using POST /customers/{customer_id}/direct_debit_mandate. developer.jortt.nl/#send-direct-debit-authorization-to-a-customer

@example

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

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

@example

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

Returns a customer using the GET /customers/{customer_id} endpoint. developer.jortt.nl/#get-customer-by-id

@example

client.customers.show("9afcd96e-caf8-40a1-96c9-1af16d0bc804")
# File lib/jortt/client/customers.rb, line 32
def show(id)
  client.get("/customers/#{id}")
end
update(id, payload) click to toggle source

Updates a Customer using the PUT /customers/{customer_id} endpoint. developer.jortt.nl/#update-customer

@example

client.customers.update(
  "9afcd96e-caf8-40a1-96c9-1af16d0bc804",
  { address_extra_information: 'foobar' }
)
# File lib/jortt/client/customers.rb, line 63
def update(id, payload)
  client.put("/customers/#{id}", payload)
end
vat_percentages(id) click to toggle source

Get vat percentages for a Customer using the GET /customers/{customer_id}/vat-percentages endpoint. developer.jortt.nl/#get-vat-percentages-for-a-customer-by-id

@example

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