Class: Tripletexer::Endpoints::Invoice
- Inherits:
-
AbstractEndpoint
- Object
- AbstractEndpoint
- Tripletexer::Endpoints::Invoice
- Defined in:
- lib/tripletexer/endpoints/invoice.rb
Defined Under Namespace
Classes: PaymentType
Instance Method Summary collapse
- #create(body) ⇒ Object
- #download_pdf(id) ⇒ Object
- #find(id, params = {}) ⇒ Object
- #payment_type ⇒ Object
- #search(date_from, date_to, params = {}) ⇒ Object
- #update_with_payment(id, payment_date, payment_type_id, paid_amount) ⇒ Object
Methods inherited from AbstractEndpoint
Constructor Details
This class inherits a constructor from Tripletexer::Endpoints::AbstractEndpoint
Instance Method Details
#create(body) ⇒ Object
16 17 18 |
# File 'lib/tripletexer/endpoints/invoice.rb', line 16 def create(body) create_entity('/v2/invoice', body) end |
#download_pdf(id) ⇒ Object
26 27 28 |
# File 'lib/tripletexer/endpoints/invoice.rb', line 26 def download_pdf(id) get("/v2/invoice/#{id}/pdf") end |
#find(id, params = {}) ⇒ Object
21 22 23 |
# File 'lib/tripletexer/endpoints/invoice.rb', line 21 def find(id, params = {}) find_entity("/v2/invoice/#{id}", params) end |
#payment_type ⇒ Object
40 41 42 |
# File 'lib/tripletexer/endpoints/invoice.rb', line 40 def payment_type Tripletexer::Endpoints::Invoice::PaymentType.new(api_client) end |
#search(date_from, date_to, params = {}) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/tripletexer/endpoints/invoice.rb', line 7 def search(date_from, date_to, params = {}) final_params = params.merge( 'invoiceDateFrom' => ::Tripletexer::FormatHelpers.format_date(date_from), 'invoiceDateTo' => ::Tripletexer::FormatHelpers.format_date(date_to) ) find_entities('/v2/invoice', final_params) end |
#update_with_payment(id, payment_date, payment_type_id, paid_amount) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/tripletexer/endpoints/invoice.rb', line 31 def update_with_payment(id, payment_date, payment_type_id, paid_amount) final_params = { 'paymentDate' => payment_date, 'paymentTypeId' => payment_type_id, 'paidAmount' => paid_amount } api_client.put("/v2/invoice/#{id}/:payment", final_params) end |