Sha256: 541fb81e01b0e9c110ceb406b01540e3901c5a0625ce5bea092bad20f024d8a3
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
module Spree class Product < Spree::Base module Webhooks extend ActiveSupport::Concern include Spree::Webhooks::HasWebhooks included do after_update_commit :queue_webhooks_requests_for_product_discontinued! end class_methods do def custom_webhook_events %w[product.back_in_stock product.backorderable product.discontinued product.out_of_stock product.activated product.archived product.drafted] end def ignored_attributes_for_update_webhook_event %w[status] end end def send_product_activated_webhook queue_webhooks_requests!('product.activated') end def send_product_archived_webhook queue_webhooks_requests!('product.archived') end def send_product_drafted_webhook queue_webhooks_requests!('product.drafted') end def queue_webhooks_requests_for_product_discontinued! return unless discontinue_on_previously_changed? return if (change = discontinue_on_previous_change).blank? || change.last.blank? queue_webhooks_requests!('product.discontinued') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spree_api-4.10.1 | app/models/spree/product/webhooks.rb |
spree_api-4.10.0 | app/models/spree/product/webhooks.rb |
spree_api-4.9.0 | app/models/spree/product/webhooks.rb |