Class: InvoicePrinter::Document::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/invoice_printer/document/item.rb

Overview

Line items for InvoicePrinter::Document

Example:

item = InvoicePrinter::Document::Item.new(
  name: 'UX consultation',
  quantity: '4',
  unit: 'hours',
  price: '$ 25',
  tax: '$ 5'
  amount: '$ 120'
)

amount should equal the quantity times price, but this is not enforced.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: nil, quantity: nil, unit: nil, price: nil, tax: nil, tax2: nil, tax3: nil, amount: nil) ⇒ Item

Returns a new instance of Item.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/invoice_printer/document/item.rb', line 30

def initialize(name: nil,
               quantity: nil,
               unit: nil,
               price: nil,
               tax: nil,
               tax2: nil,
               tax3: nil,
               amount: nil)
  @name = String(name)
  @quantity = String(quantity)
  @unit = String(unit)
  @price = String(price)
  @tax = String(tax)
  @tax2 = String(tax2)
  @tax3 = String(tax3)
  @amount = String(amount)
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



21
22
23
# File 'lib/invoice_printer/document/item.rb', line 21

def amount
  @amount
end

#nameObject (readonly)

Returns the value of attribute name.



21
22
23
# File 'lib/invoice_printer/document/item.rb', line 21

def name
  @name
end

#priceObject (readonly)

Returns the value of attribute price.



21
22
23
# File 'lib/invoice_printer/document/item.rb', line 21

def price
  @price
end

#quantityObject (readonly)

Returns the value of attribute quantity.



21
22
23
# File 'lib/invoice_printer/document/item.rb', line 21

def quantity
  @quantity
end

#taxObject (readonly)

Returns the value of attribute tax.



21
22
23
# File 'lib/invoice_printer/document/item.rb', line 21

def tax
  @tax
end

#tax2Object (readonly)

Returns the value of attribute tax2.



21
22
23
# File 'lib/invoice_printer/document/item.rb', line 21

def tax2
  @tax2
end

#tax3Object (readonly)

Returns the value of attribute tax3.



21
22
23
# File 'lib/invoice_printer/document/item.rb', line 21

def tax3
  @tax3
end

#unitObject (readonly)

Returns the value of attribute unit.



21
22
23
# File 'lib/invoice_printer/document/item.rb', line 21

def unit
  @unit
end