Class: Stockman::Logic::Variant::StockLevel

Inherits:
Object
  • Object
show all
Defined in:
lib/stockman/logic/variant/stock_level.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(variant_id, warehouse_id) ⇒ StockLevel

Returns a new instance of StockLevel.



7
8
9
10
# File 'lib/stockman/logic/variant/stock_level.rb', line 7

def initialize(variant_id, warehouse_id)
  @variant_id = variant_id.to_i
  @warehouse_id = warehouse_id.to_i
end

Instance Attribute Details

#variant_idObject (readonly)

Returns the value of attribute variant_id.



5
6
7
# File 'lib/stockman/logic/variant/stock_level.rb', line 5

def variant_id
  @variant_id
end

#warehouse_idObject (readonly)

Returns the value of attribute warehouse_id.



5
6
7
# File 'lib/stockman/logic/variant/stock_level.rb', line 5

def warehouse_id
  @warehouse_id
end

Instance Method Details

#allocated_amountObject



16
17
18
# File 'lib/stockman/logic/variant/stock_level.rb', line 16

def allocated_amount
  obtain_amount(:allocated)
end

#available_amountObject



20
21
22
# File 'lib/stockman/logic/variant/stock_level.rb', line 20

def available_amount
  physical_amount - allocated_amount
end

#physical_amountObject



12
13
14
# File 'lib/stockman/logic/variant/stock_level.rb', line 12

def physical_amount
  obtain_amount(:physical)
end