Class: MaliPoPay::Resources::Invoices
- Inherits:
-
Object
- Object
- MaliPoPay::Resources::Invoices
- Defined in:
- lib/malipopay/resources/invoices.rb
Instance Method Summary collapse
-
#approve_draft(params) ⇒ Hash
Approve a draft invoice.
-
#create(params) ⇒ Hash
Create a new invoice.
-
#get(id) ⇒ Hash
Get an invoice by ID.
-
#get_by_number(number) ⇒ Hash
Get an invoice by invoice number.
-
#initialize(http_client) ⇒ Invoices
constructor
A new instance of Invoices.
-
#list(params = {}) ⇒ Hash
List all invoices.
-
#record_payment(params) ⇒ Hash
Record a payment against an invoice.
-
#update(id, params) ⇒ Hash
Update an existing invoice.
Constructor Details
#initialize(http_client) ⇒ Invoices
Returns a new instance of Invoices.
6 7 8 |
# File 'lib/malipopay/resources/invoices.rb', line 6 def initialize(http_client) @http = http_client end |
Instance Method Details
#approve_draft(params) ⇒ Hash
Approve a draft invoice
56 57 58 |
# File 'lib/malipopay/resources/invoices.rb', line 56 def approve_draft(params) @http.post("/api/v1/invoice/approve-draft", body: params) end |
#create(params) ⇒ Hash
Create a new invoice
13 14 15 |
# File 'lib/malipopay/resources/invoices.rb', line 13 def create(params) @http.post("/api/v1/invoice", body: params) end |
#get(id) ⇒ Hash
Get an invoice by ID
27 28 29 |
# File 'lib/malipopay/resources/invoices.rb', line 27 def get(id) @http.get("/api/v1/invoice/#{id}") end |
#get_by_number(number) ⇒ Hash
Get an invoice by invoice number
34 35 36 |
# File 'lib/malipopay/resources/invoices.rb', line 34 def get_by_number(number) @http.get("/api/v1/invoice", params: { invoiceNumber: number }) end |
#list(params = {}) ⇒ Hash
List all invoices
20 21 22 |
# File 'lib/malipopay/resources/invoices.rb', line 20 def list(params = {}) @http.get("/api/v1/invoice", params: params) end |
#record_payment(params) ⇒ Hash
Record a payment against an invoice
49 50 51 |
# File 'lib/malipopay/resources/invoices.rb', line 49 def record_payment(params) @http.post("/api/v1/invoice/record-payment", body: params) end |
#update(id, params) ⇒ Hash
Update an existing invoice
42 43 44 |
# File 'lib/malipopay/resources/invoices.rb', line 42 def update(id, params) @http.put("/api/v1/invoice/#{id}", body: params) end |