Sha256: fdb305ff8449efffcb03c01a76c74a0426f503cf7a80cc614a4aaa6fb071c5d8

Contents?: true

Size: 484 Bytes

Versions: 33

Compression:

Stored size: 484 Bytes

Contents

module Spree
  module PromotionHandler
    class Page
      attr_reader :order, :path, :store

      def initialize(order, path)
        @order = order
        @store = order.store
        @path = path.gsub(/\A\//, '')
      end

      def activate
        if promotion&.eligible?(order)
          promotion.activate(order: order)
        end
      end

      private

      def promotion
        @promotion ||= store.promotions.active.find_by(path: path)
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
spree_core-4.10.1 app/models/spree/promotion_handler/page.rb
spree_core-4.10.0 app/models/spree/promotion_handler/page.rb
spree_core-4.9.0 app/models/spree/promotion_handler/page.rb
spree_core-4.8.3 app/models/spree/promotion_handler/page.rb
spree_core-4.8.2 app/models/spree/promotion_handler/page.rb
spree_core-4.7.3 app/models/spree/promotion_handler/page.rb
spree_core-4.6.6 app/models/spree/promotion_handler/page.rb
spree_core-4.5.5 app/models/spree/promotion_handler/page.rb
spree_core-4.3.3 app/models/spree/promotion_handler/page.rb
spree_core-4.4.1 app/models/spree/promotion_handler/page.rb
spree_core-4.5.4 app/models/spree/promotion_handler/page.rb
spree_core-4.6.5 app/models/spree/promotion_handler/page.rb
spree_core-4.7.2 app/models/spree/promotion_handler/page.rb
spree_core-4.7.1 app/models/spree/promotion_handler/page.rb
spree_core-4.6.4 app/models/spree/promotion_handler/page.rb
spree_core-4.7.0 app/models/spree/promotion_handler/page.rb
spree_core-4.6.3 app/models/spree/promotion_handler/page.rb
spree_core-4.6.2 app/models/spree/promotion_handler/page.rb
spree_core-4.6.1 app/models/spree/promotion_handler/page.rb
spree_core-4.6.0 app/models/spree/promotion_handler/page.rb