Module: ActiveCart::Item

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) id

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

- (Object) name

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

- (Object) price

Returns the price of this item

Raises:

  • (NotImplementedError)


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

def price
  raise NotImplementedError
end

- (Object) quantity

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

- (Object) quantity=(quantity)

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