Sha256: d19f1f5595232e6a469ccc420ed082a75894c3f66d39f6428f51871c47167525
Contents?: true
Size: 702 Bytes
Versions: 2
Compression:
Stored size: 702 Bytes
Contents
module Stockman module Logic class Variant class StockLevel attr_reader :variant_id, :warehouse_id def initialize(variant_id, warehouse_id) @variant_id = variant_id.to_i @warehouse_id = warehouse_id.to_i end def physical_amount obtain_amount(:physical) end def allocated_amount obtain_amount(:allocated) end def available_amount physical_amount - allocated_amount end private def obtain_amount(type) Storage.obtain_amount("variants:#{variant_id}:stock_levels:#{warehouse_id}", :"#{type}_amount") end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
stockman-logic-0.1.1 | lib/stockman/logic/variant/stock_level.rb |
stockman-logic-0.1.0 | lib/stockman/logic/variant/stock_level.rb |