Class: Zazu::Resources::Invoices
- Defined in:
- lib/zazu/resources/invoices.rb
Overview
Invoices and their lifecycle actions.
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#cancel(id) ⇒ Object
POST /api/invoices/:id/cancel.
-
#create(**attributes) ⇒ Object
POST /api/invoices.
-
#create_payment_link(invoice_id, account_id:) ⇒ Object
POST /api/invoices/:invoice_id/payment_link.
-
#credit_note(id) ⇒ Object
POST /api/invoices/:id/credit_note.
-
#delete(id) ⇒ Object
DELETE /api/invoices/:id.
-
#get(id) ⇒ Object
GET /api/invoices/:id.
-
#list(status: nil, customer_id: nil, limit: MAX_PER_PAGE, cursor: nil) ⇒ Object
GET /api/invoices.
-
#mark_as_paid(id) ⇒ Object
POST /api/invoices/:id/mark_as_paid.
-
#send_invoice(id) ⇒ Object
POST /api/invoices/:id/send.
-
#update(id, **attributes) ⇒ Object
PATCH /api/invoices/:id.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Zazu::Resources::Base
Instance Method Details
#cancel(id) ⇒ Object
POST /api/invoices/:id/cancel
44 45 46 |
# File 'lib/zazu/resources/invoices.rb', line 44 def cancel(id) http_post(encode_path("api/invoices", id, "cancel")) end |
#create(**attributes) ⇒ Object
POST /api/invoices
24 25 26 |
# File 'lib/zazu/resources/invoices.rb', line 24 def create(**attributes) http_post("api/invoices", body: attributes) end |
#create_payment_link(invoice_id, account_id:) ⇒ Object
POST /api/invoices/:invoice_id/payment_link
61 62 63 64 65 66 |
# File 'lib/zazu/resources/invoices.rb', line 61 def create_payment_link(invoice_id, account_id:) http_post( encode_path("api/invoices", invoice_id, "payment_link"), body: { account_id: account_id } ) end |
#credit_note(id) ⇒ Object
POST /api/invoices/:id/credit_note
49 50 51 |
# File 'lib/zazu/resources/invoices.rb', line 49 def credit_note(id) http_post(encode_path("api/invoices", id, "credit_note")) end |
#delete(id) ⇒ Object
DELETE /api/invoices/:id
54 55 56 |
# File 'lib/zazu/resources/invoices.rb', line 54 def delete(id) http_delete(encode_path("api/invoices", id)) end |
#get(id) ⇒ Object
GET /api/invoices/:id
19 20 21 |
# File 'lib/zazu/resources/invoices.rb', line 19 def get(id) http_get(encode_path("api/invoices", id)) end |
#list(status: nil, customer_id: nil, limit: MAX_PER_PAGE, cursor: nil) ⇒ Object
GET /api/invoices
8 9 10 11 12 13 14 15 16 |
# File 'lib/zazu/resources/invoices.rb', line 8 def list(status: nil, customer_id: nil, limit: MAX_PER_PAGE, cursor: nil) list_page( "api/invoices", status: status, customer_id: customer_id, limit: limit, cursor: cursor ) end |
#mark_as_paid(id) ⇒ Object
POST /api/invoices/:id/mark_as_paid
39 40 41 |
# File 'lib/zazu/resources/invoices.rb', line 39 def mark_as_paid(id) http_post(encode_path("api/invoices", id, "mark_as_paid")) end |
#send_invoice(id) ⇒ Object
POST /api/invoices/:id/send
34 35 36 |
# File 'lib/zazu/resources/invoices.rb', line 34 def send_invoice(id) http_post(encode_path("api/invoices", id, "send")) end |
#update(id, **attributes) ⇒ Object
PATCH /api/invoices/:id
29 30 31 |
# File 'lib/zazu/resources/invoices.rb', line 29 def update(id, **attributes) http_patch(encode_path("api/invoices", id), body: attributes) end |