Class: BadBill::InvoicePayment
- Inherits:
-
BaseResource
- Object
- BaseResource
- BadBill::InvoicePayment
- Defined in:
- lib/badbill/invoice_payment.rb
Overview
The InvoicePayment resource handles all invoice payments.
Instance Attribute Summary
Attributes inherited from BaseResource
Class Method Summary collapse
-
.create(invoice_id, amount, is_paid = false, params = {}) ⇒ InvoicePayment, Hashie::Mash
Create a new invoice payment.
Methods inherited from BaseResource
all, #delete, #error, find, #initialize, #save
Methods included from Resource
#call, #delete, #get, #post, #put
Methods included from ForwardMethods
Constructor Details
This class inherits a constructor from BadBill::BaseResource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class BadBill::ForwardMethods
Class Method Details
.create(invoice_id, amount, is_paid = false, params = {}) ⇒ InvoicePayment, Hashie::Mash
Create a new invoice payment.
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/badbill/invoice_payment.rb', line 16 def self.create invoice_id, amount, is_paid=false, params={} params['invoice_id'] = invoice_id params['amount'] = amount params['mark_invoice_as_paid'] = is_paid res = post(resource_name, {resource_name_singular => params}) return res if res.error res_data = res.__send__(resource_name_singular) new res_data.id.to_i, res_data end |