class InvoicePrinter::Document::Item
Line items for InvoicePrinter::Document
Example:
item = InvoicePrinter::Document::Item.new( name: 'UX consultation', breakdown: "Monday 3h\nTuesday 1h" variable: 'June 2008', quantity: '4', unit: 'hours', price: '$ 25', tax: '$ 5' amount: '$ 120' )
amount
should equal the quantity
times price
, but this is not enforced.
Attributes
amount[R]
breakdown[R]
name[R]
price[R]
quantity[R]
tax[R]
tax2[R]
tax3[R]
unit[R]
variable[R]
Public Class Methods
from_json(json)
click to toggle source
# File lib/invoice_printer/document/item.rb, line 33 def from_json(json) new( name: json['name'], breakdown: json['breakdown'], variable: json['variable'], quantity: json['quantity'], unit: json['unit'], price: json['price'], tax: json['tax'], tax2: json['tax2'], tax3: json['tax3'], amount: json['amount'] ) end
new(name: nil, breakdown: nil, variable: nil, quantity: nil, unit: nil, price: nil, tax: nil, tax2: nil, tax3: nil, amount: nil)
click to toggle source
# File lib/invoice_printer/document/item.rb, line 49 def initialize(name: nil, breakdown: nil, variable: nil, quantity: nil, unit: nil, price: nil, tax: nil, tax2: nil, tax3: nil, amount: nil) @name = String(name) @breakdown = String(breakdown) @variable = String(variable) @quantity = String(quantity) @unit = String(unit) @price = String(price) @tax = String(tax) @tax2 = String(tax2) @tax3 = String(tax3) @amount = String(amount) end
Public Instance Methods
to_h()
click to toggle source
# File lib/invoice_printer/document/item.rb, line 72 def to_h { 'name': @name, 'breakdown': @breakdown, 'variable': @variable, 'quantity': @quantity, 'unit': @unit, 'price': @price, 'tax': @tax, 'tax2': @tax2, 'tax3': @tax3, 'amount': @amount, } end
to_json()
click to toggle source
# File lib/invoice_printer/document/item.rb, line 87 def to_json to_h.to_json end