Class: SolidusFriendlyPromotions::PromotionHandler::Page
- Inherits:
-
Object
- Object
- SolidusFriendlyPromotions::PromotionHandler::Page
- Defined in:
- app/models/solidus_friendly_promotions/promotion_handler/page.rb
Instance Attribute Summary collapse
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #activate ⇒ Object
-
#initialize(order, path) ⇒ Page
constructor
A new instance of Page.
Constructor Details
#initialize(order, path) ⇒ Page
Returns a new instance of Page.
8 9 10 11 |
# File 'app/models/solidus_friendly_promotions/promotion_handler/page.rb', line 8 def initialize(order, path) @order = order @path = path.gsub(/\A\//, "") end |
Instance Attribute Details
#order ⇒ Object (readonly)
Returns the value of attribute order.
6 7 8 |
# File 'app/models/solidus_friendly_promotions/promotion_handler/page.rb', line 6 def order @order end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'app/models/solidus_friendly_promotions/promotion_handler/page.rb', line 6 def path @path end |
Instance Method Details
#activate ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'app/models/solidus_friendly_promotions/promotion_handler/page.rb', line 13 def activate if promotion Spree::Config.promotion_adjuster_class.new(order, dry_run_promotion: promotion).call if promotion.eligibility_results.success? order.friendly_promotions << promotion order.recalculate end end end |