Class: Spree::OrderRoutingRule
- Inherits:
-
Object
- Object
- Spree::OrderRoutingRule
- Includes:
- SingleStoreResource
- Defined in:
- app/models/spree/order_routing_rule.rb
Overview
STI base for order routing rules. Subclasses live in app/models/spree/order_routing/rules/ and implement #rank(order, locations).
Plugins extend the engine by defining a new subclass:
class AcmeFresh::OrderRouting::RefrigeratedRule < Spree::OrderRoutingRule
preference :max_temp_c, :integer, default: 4
def rank(order, locations)
# ... return Array<LocationRanking>
end
end
See docs/plans/6.0-order-routing.md.
Direct Known Subclasses
Spree::OrderRouting::Rules::DefaultLocation, Spree::OrderRouting::Rules::MinimizeSplits, Spree::OrderRouting::Rules::PreferredLocation
Defined Under Namespace
Classes: LocationRanking
Instance Method Summary collapse
-
#rank(_order, _locations) ⇒ Array<LocationRanking>
Subclasses override.
Instance Method Details
#rank(_order, _locations) ⇒ Array<LocationRanking>
Subclasses override. Returns an Array<LocationRanking> — one per location, with rank=nil to abstain.
52 53 54 |
# File 'app/models/spree/order_routing_rule.rb', line 52 def rank(_order, _locations) raise NotImplementedError, "#{self.class} must implement #rank(order, locations)" end |