Class: Rubill::Invoice
- Inherits:
-
Base
- Object
- Base
- Rubill::Invoice
show all
- Defined in:
- lib/rubill/entities/invoice.rb
Instance Attribute Summary
Attributes inherited from Base
#remote_record
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#[], #[]=, active, all, create, delete, #delete, find, find_by_name, #id, #initialize, #save, update, where
Constructor Details
This class inherits a constructor from Rubill::Base
Class Method Details
.line_item(amount, description, item_id) ⇒ Object
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/rubill/entities/invoice.rb', line 31
def self.line_item(amount, description, item_id)
{
entity: "InvoiceLineItem",
quantity: 1,
itemId: item_id,
price: amount.to_f,
description: description,
}
end
|
Instance Method Details
#amount ⇒ Object
7
8
9
|
# File 'lib/rubill/entities/invoice.rb', line 7
def amount
remote_record[:amount]
end
|
#amount_due ⇒ Object
27
28
29
|
# File 'lib/rubill/entities/invoice.rb', line 27
def amount_due
remote_record[:amountDue]
end
|
#amount_paid ⇒ Object
3
4
5
|
# File 'lib/rubill/entities/invoice.rb', line 3
def amount_paid
amount - amount_due
end
|
#send_email(subject, body, contact_emails) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/rubill/entities/invoice.rb', line 11
def send_email(subject, body, contact_emails)
Query.execute(
"/SendInvoice.json",
{
invoiceId: id,
headers: {
subject: subject,
toEmailAddresses: contact_emails
},
content: {
body: body
}
}
)
end
|