Sha256: dc4c348fd0d3d3b1bbff2d388965f31c9cf634eb40059facf29e4aac8b69318f

Contents?: true

Size: 824 Bytes

Versions: 13

Compression:

Stored size: 824 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'

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

    # 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

13 entries across 13 versions & 1 rubygems

Version Path
spree_promo-1.1.1 app/models/spree/promotion_action.rb
spree_promo-1.1.0 app/models/spree/promotion_action.rb
spree_promo-1.0.4 app/models/spree/promotion_action.rb
spree_promo-1.1.0.rc2 app/models/spree/promotion_action.rb
spree_promo-1.1.0.rc1 app/models/spree/promotion_action.rb
spree_promo-1.0.3 app/models/spree/promotion_action.rb
spree_promo-1.0.2 app/models/spree/promotion_action.rb
spree_promo-1.0.1 app/models/spree/promotion_action.rb
spree_promo-1.0.0 app/models/spree/promotion_action.rb
spree_promo-1.0.0.rc4 app/models/spree/promotion_action.rb
spree_promo-1.0.0.rc3 app/models/spree/promotion_action.rb
spree_promo-1.0.0.rc2 app/models/spree/promotion_action.rb
spree_promo-1.0.0.rc1 app/models/spree/promotion_action.rb