Sha256: a4a0e70914f4c26dd0b6c25a57787953489a15c87ff0c52405940ce6fdc98e32

Contents?: true

Size: 899 Bytes

Versions: 22

Compression:

Stored size: 899 Bytes

Contents

# Base class for all types of promotion action.
# PromotionActions perform the necessary tasks when a promotion is activated by an event and determined to be eligible.
module Spree
  class PromotionAction < ActiveRecord::Base
    belongs_to :promotion, :foreign_key => 'activator_id', :class_name => "Spree::Promotion"

    scope :of_type, lambda {|t| {:conditions => {:type => t}}}

    attr_accessible :line_items_string

    # This method should be overriden in subclass
    # Updates the state of the order or performs some other action depending on the subclass
    # options will contain the payload from the event that activated the promotion. This will include
    # the key :user which allows user based actions to be performed in addition to actions on the order
    def perform(options = {})
      raise 'perform should be implemented in a sub-class of PromotionAction'
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
spree_promo-1.3.5 app/models/spree/promotion_action.rb
spree_promo-1.3.4 app/models/spree/promotion_action.rb
spree_promo-1.2.5 app/models/spree/promotion_action.rb
spree_promo-1.3.3 app/models/spree/promotion_action.rb
spree_promo-1.1.6 app/models/spree/promotion_action.rb
spree_promo-1.1.5 app/models/spree/promotion_action.rb
spree_promo-1.2.4 app/models/spree/promotion_action.rb
spree_promo-1.3.2 app/models/spree/promotion_action.rb
spree_promo-1.2.3 app/models/spree/promotion_action.rb
spree_promo-1.3.1 app/models/spree/promotion_action.rb
spree_promo-1.3.0 app/models/spree/promotion_action.rb
spree_promo-1.3.0.rc2 app/models/spree/promotion_action.rb
dup_spree_promo-1.3.0.rc1 app/models/spree/promotion_action.rb
spree_promo-1.3.0.rc1 app/models/spree/promotion_action.rb
spree_promo-1.2.2 app/models/spree/promotion_action.rb
spree_promo-1.1.4 app/models/spree/promotion_action.rb
spree_promo-1.2.0 app/models/spree/promotion_action.rb
spree_promo-1.2.0.rc2 app/models/spree/promotion_action.rb
spree_promo-1.2.0.rc1 app/models/spree/promotion_action.rb
spree_promo-1.1.3 app/models/spree/promotion_action.rb