Class: Spree::Stock::Coordinator

Inherits:
Object
  • Object
show all
Defined in:
app/models/spree/stock/coordinator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(order, inventory_units = nil) ⇒ Coordinator

Returns a new instance of Coordinator.



6
7
8
9
10
# File 'app/models/spree/stock/coordinator.rb', line 6

def initialize(order, inventory_units = nil)
  @order = order
  @inventory_units = inventory_units || InventoryUnitBuilder.new(order).units
  @preallocated_inventory_units = []
end

Instance Attribute Details

#inventory_unitsObject (readonly)

Returns the value of attribute inventory_units.



4
5
6
# File 'app/models/spree/stock/coordinator.rb', line 4

def inventory_units
  @inventory_units
end

#orderObject (readonly)

Returns the value of attribute order.



4
5
6
# File 'app/models/spree/stock/coordinator.rb', line 4

def order
  @order
end

Instance Method Details

#shipmentsObject



12
13
14
# File 'app/models/spree/stock/coordinator.rb', line 12

def shipments
  packages.map(&:shipment)
end