Module: ActiveCart::Item

Included in:
ActiveCart::Items::MemoryItem
Defined in:
lib/active_cart/item.rb

Instance Method Summary collapse

Instance Method Details

#idObject

A unique id for the item. The Mixee needs to implement this or a NotImplementedError will be thrown

Raises:

  • (NotImplementedError)


8
9
10
# File 'lib/active_cart/item.rb', line 8

def id
  raise NotImplementedError
end

#nameObject

A display name for the item. The Mixee needs to implement this or a NotImplementedError will be thrown

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/active_cart/item.rb', line 14

def name
  raise NotImplementedError
end

#priceObject

Returns the price of this item

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/active_cart/item.rb', line 32

def price
  raise NotImplementedError
end

#quantityObject

Returns the quantity of this item in the context of a cart



20
21
22
# File 'lib/active_cart/item.rb', line 20

def quantity
  @quantity || 0
end

#quantity=(quantity) ⇒ Object

Set the quantity of this item in the context of a cart



26
27
28
# File 'lib/active_cart/item.rb', line 26

def quantity=(quantity)
  @quantity = quantity
end