class Stockman::Logic::Product

Attributes

id[R]

Public Class Methods

new(id) click to toggle source
# File lib/stockman/logic/product.rb, line 10
def initialize(id)
  @id = id
end

Public Instance Methods

stock_levels() click to toggle source
# File lib/stockman/logic/product.rb, line 26
def stock_levels
  @stock_levels ||= StockLevelsCollection.new(id)
end
summary() click to toggle source
# File lib/stockman/logic/product.rb, line 30
def summary
  @summary ||= Summary.from_object(self)
end
total_allocated_amount() click to toggle source
# File lib/stockman/logic/product.rb, line 18
def total_allocated_amount
  stock_levels.sum(&:allocated_amount)
end
total_available_amount() click to toggle source
# File lib/stockman/logic/product.rb, line 22
def total_available_amount
  stock_levels.sum(&:available_amount)
end
total_physical_amount() click to toggle source
# File lib/stockman/logic/product.rb, line 14
def total_physical_amount
  stock_levels.sum(&:physical_amount)
end