Sha256: bc86901386413532cb93d3a46c0e6b5e5ddc3a33b5b69695d86703e4cc9d504b

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

require 'invoice_printer/document'

module InvoicePrinter
  class Document
    # 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.
    class Item
      attr_reader :name,
                  :quantity,
                  :unit,
                  :price,
                  :tax,
                  :tax2,
                  :tax3,
                  :amount

      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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
invoice_printer-0.0.5 lib/invoice_printer/document/item.rb
invoice_printer-0.0.4 lib/invoice_printer/document/item.rb
invoice_printer-0.0.3 lib/invoice_printer/document/item.rb
invoice_printer-0.0.2 lib/invoice_printer/document/item.rb