Class: Spree::ShipmentHandler
- Inherits:
-
Object
- Object
- Spree::ShipmentHandler
- Includes:
- IntegrationsConcern, Spree::Shipment::Emails
- Defined in:
- app/models/spree/shipment_handler.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(shipment) ⇒ ShipmentHandler
constructor
A new instance of ShipmentHandler.
- #perform ⇒ Object
Methods included from IntegrationsConcern
#store_integration, #store_integrations
Methods included from Spree::Shipment::Emails
Constructor Details
#initialize(shipment) ⇒ ShipmentHandler
Returns a new instance of ShipmentHandler.
19 20 21 |
# File 'app/models/spree/shipment_handler.rb', line 19 def initialize(shipment) @shipment = shipment end |
Class Method Details
.factory(shipment) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'app/models/spree/shipment_handler.rb', line 7 def factory(shipment) # Do we have a specialized shipping-method-specific handler? e.g: # Given shipment.shipping_method = Spree::ShippingMethod::DigitalDownload # do we have Spree::ShipmentHandler::DigitalDownload? if sm_handler = "Spree::ShipmentHandler::#{shipment.shipping_method.name.split('::').last}".safe_constantize sm_handler.new(shipment) else new(shipment) end end |
Instance Method Details
#perform ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/models/spree/shipment_handler.rb', line 23 def perform @shipment.inventory_units.each &:ship! @shipment.process_order_payments if Spree::Config[:auto_capture_on_dispatch] @shipment.touch :shipped_at update_order_shipment_state send_shipped_email end |