Class: Spree::PromotionHandler::FreeShipping
- Inherits:
-
Object
- Object
- Spree::PromotionHandler::FreeShipping
- Defined in:
- app/models/spree/promotion_handler/free_shipping.rb
Overview
Used for activating promotions with shipping rules
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#success ⇒ Object
Returns the value of attribute success.
Instance Method Summary collapse
- #activate ⇒ Object
-
#initialize(order) ⇒ FreeShipping
constructor
A new instance of FreeShipping.
Constructor Details
#initialize(order) ⇒ FreeShipping
Returns a new instance of FreeShipping.
8 9 10 |
# File 'app/models/spree/promotion_handler/free_shipping.rb', line 8 def initialize(order) @order = order end |
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
6 7 8 |
# File 'app/models/spree/promotion_handler/free_shipping.rb', line 6 def error @error end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
5 6 7 |
# File 'app/models/spree/promotion_handler/free_shipping.rb', line 5 def order @order end |
#success ⇒ Object
Returns the value of attribute success.
6 7 8 |
# File 'app/models/spree/promotion_handler/free_shipping.rb', line 6 def success @success end |
Instance Method Details
#activate ⇒ Object
12 13 14 15 16 17 18 |
# File 'app/models/spree/promotion_handler/free_shipping.rb', line 12 def activate promotions.each do |promotion| if promotion.eligible?(order) promotion.activate(order: order) end end end |