Class: Spree::Promotion::Rules::UserLoggedIn
- Inherits:
-
Spree::PromotionRule
- Object
- Spree::PromotionRule
- Spree::Promotion::Rules::UserLoggedIn
- Defined in:
- app/models/spree/promotion/rules/user_logged_in.rb
Class Method Summary collapse
-
.api_type ⇒ Object
Wire-format shorthand is ‘customer_logged_in` (the model is still `UserLoggedIn` pre-6.0 rename, see docs/plans/6.0-platform-auth.md).
Instance Method Summary collapse
Methods inherited from Spree::PromotionRule
#actionable?, additional_permitted_attributes, #eligibility_errors, for, human_description, #human_description, human_name, #human_name, #key
Class Method Details
.api_type ⇒ Object
Wire-format shorthand is ‘customer_logged_in` (the model is still `UserLoggedIn` pre-6.0 rename, see docs/plans/6.0-platform-auth.md).
7 8 9 |
# File 'app/models/spree/promotion/rules/user_logged_in.rb', line 7 def self.api_type 'customer_logged_in' end |
Instance Method Details
#applicable?(promotable) ⇒ Boolean
11 12 13 |
# File 'app/models/spree/promotion/rules/user_logged_in.rb', line 11 def applicable?(promotable) promotable.is_a?(Spree::Order) end |
#eligible?(order, _options = {}) ⇒ Boolean
15 16 17 18 19 20 |
# File 'app/models/spree/promotion/rules/user_logged_in.rb', line 15 def eligible?(order, = {}) unless order.user.present? eligibility_errors.add(:base, (:no_user_specified)) end eligibility_errors.empty? end |