Class: Panier::Domain::Product

Inherits:
Object
  • Object
show all
Defined in:
lib/panier/domain/product.rb

Overview

A product is a purchasable item with a price and one or more tax classes that allow taxes to be calculated accurately.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, price, tax_classes = []) ⇒ Product

Initializes the product using the given name, price and optional tax classes.

Parameters:

  • name (String)
  • price (Money)
  • tax_classes (Array) (defaults to: [])


21
22
23
24
25
# File 'lib/panier/domain/product.rb', line 21

def initialize(name, price, tax_classes = [])
  @name = name
  self.price = price
  @tax_classes = tax_classes
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/panier/domain/product.rb', line 10

def name
  @name
end

#priceObject

Returns the value of attribute price.



11
12
13
# File 'lib/panier/domain/product.rb', line 11

def price
  @price
end

#tax_classesObject

Returns the value of attribute tax_classes.



10
11
12
# File 'lib/panier/domain/product.rb', line 10

def tax_classes
  @tax_classes
end