Sha256: ad302e64ed7efa27519904d40a26cdc442e830947b9af88ceb041bc92fd0bbe5

Contents?: true

Size: 759 Bytes

Versions: 26

Compression:

Stored size: 759 Bytes

Contents

module Spree
  module Api
    module Webhooks
      module VariantDecorator
        def self.prepended(base)
          def base.custom_webhook_events
            %w[variant.back_in_stock variant.backorderable variant.discontinued variant.out_of_stock]
          end

          base.after_update_commit :queue_webhooks_requests_for_variant_discontinued!
        end

        private

        def queue_webhooks_requests_for_variant_discontinued!
          return unless discontinue_on_previously_changed?
          return if (change = discontinue_on_previous_change).blank? || change.last.blank?

          queue_webhooks_requests!('variant.discontinued')
        end
      end
    end
  end
end

Spree::Variant.prepend(Spree::Api::Webhooks::VariantDecorator)

Version data entries

26 entries across 26 versions & 3 rubygems

Version Path
spree_api-4.8.3 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.8.2 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.7.3 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.6.6 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.5.5 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.4.1 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.5.4 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.6.5 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.7.2 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.7.1 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.6.4 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.7.0 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.6.3 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.6.2 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.6.1 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.6.0 app/models/spree/api/webhooks/variant_decorator.rb
spree_api-4.5.3 app/models/spree/api/webhooks/variant_decorator.rb
atkhayar-dev-spree-api-0.0.1 app/models/spree/api/webhooks/variant_decorator.rb
atkhayar-dev-spree-api-0.0.0 app/models/spree/api/webhooks/variant_decorator.rb
atkhayar-spree-dev-api-0.0.0 app/models/spree/api/webhooks/variant_decorator.rb