Class: Billrb::Invoice

Inherits:
Resource show all
Extended by:
Operations::Archive, Operations::Create, Operations::List, Operations::Replace, Operations::Retrieve, Operations::Update
Defined in:
lib/billrb/resources/invoice.rb

Instance Attribute Summary

Attributes inherited from Resource

#attributes

Class Method Summary collapse

Methods included from Operations::List

list

Methods included from Operations::Retrieve

retrieve

Methods included from Operations::Create

create

Methods included from Operations::Update

update

Methods included from Operations::Replace

replace

Methods included from Operations::Archive

archive, restore

Methods inherited from Resource

#[], #id, #initialize, #inspect, #method_missing, #respond_to_missing?, #to_h

Constructor Details

This class inherits a constructor from Billrb::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Billrb::Resource

Class Method Details

POST /v3/invoices/Resource#id/payment-link — returns a payment link the customer can use to pay the invoice.



23
24
25
26
# File 'lib/billrb/resources/invoice.rb', line 23

def self.payment_link(id, params = {}, options = {})
  Resource.new(Operations.client_from(options).post("#{resource_path}/#{id}/payment-link",
                                                    Util.camelize_keys(params)))
end

.record_payment(params, options = {}) ⇒ Object

POST /v3/invoices/record-payment — records a payment received outside BILL (cash, check, …) and applies it to one or more invoices.



30
31
32
33
34
# File 'lib/billrb/resources/invoice.rb', line 30

def self.record_payment(params, options = {})
  ReceivablePayment.new(Operations.client_from(options).post(
    "#{resource_path}/record-payment", Util.camelize_keys(params),
  ))
end

.send_email(id, params = {}, options = {}) ⇒ Object

POST /v3/invoices/Resource#id/email — emails the invoice (with PDF attached) to the customer, e.g. send_email(id, recipient: { to: [“a@b.test”] }).



16
17
18
19
# File 'lib/billrb/resources/invoice.rb', line 16

def self.send_email(id, params = {}, options = {})
  Resource.new(Operations.client_from(options).post("#{resource_path}/#{id}/email",
                                                    Util.camelize_keys(params)))
end