Class: Payday::LineItem

Inherits:
Object
  • Object
show all
Includes:
LineItemable
Defined in:
lib/payday/line_item.rb

Overview

Represents a line item in an invoice.

quantity and price are written to be pretty picky, primarily because if we’re not picky about what values are set to them your invoice math could get pretty messed up. It’s recommended that both values be set to BigDecimal values. Otherwise, we’ll do our best to convert the set values to a BigDecimal.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from LineItemable

#amount

Constructor Details

#initialize(options = {}) ⇒ LineItem

Initializes a new LineItem



13
14
15
16
17
18
19
# File 'lib/payday/line_item.rb', line 13

def initialize(options = {})
  self.quantity = options[:quantity] || "1"
  self.display_quantity = options[:display_quantity]
  self.display_price = options[:display_price]
  self.price = options[:price] || "0.00"
  self.description = options[:description] || ""
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



10
11
12
# File 'lib/payday/line_item.rb', line 10

def description
  @description
end

#display_priceObject

Returns the value of attribute display_price.



10
11
12
# File 'lib/payday/line_item.rb', line 10

def display_price
  @display_price
end

#display_quantityObject

Returns the value of attribute display_quantity.



10
11
12
# File 'lib/payday/line_item.rb', line 10

def display_quantity
  @display_quantity
end

#priceObject

Returns the value of attribute price.



10
11
12
# File 'lib/payday/line_item.rb', line 10

def price
  @price
end

#quantityObject

Returns the value of attribute quantity.



10
11
12
# File 'lib/payday/line_item.rb', line 10

def quantity
  @quantity
end