Sha256: 5d5ea88ceeb60ff0ce7cf9400689c129f4569b2585e57d22db67e8e54cc74e4e
Contents?: true
Size: 889 Bytes
Versions: 3
Compression:
Stored size: 889 Bytes
Contents
# frozen_string_literal: true module ShopifyApp class MissingWebhookJobError < StandardError; end class WebhooksController < ActionController::Base include ShopifyApp::WebhookVerification def receive params.permit! job_args = { shop_domain: shop_domain, webhook: webhook_params.to_h } webhook_job_klass.perform_later(job_args) head(:no_content) end private def webhook_params params.except(:controller, :action, :type) end def webhook_job_klass webhook_job_klass_name.safe_constantize || raise(ShopifyApp::MissingWebhookJobError) end def webhook_job_klass_name(type = webhook_type) [webhook_namespace, "#{type}_job"].compact.join('/').classify end def webhook_type params[:type] end def webhook_namespace ShopifyApp.configuration.webhook_jobs_namespace end end end
Version data entries
3 entries across 3 versions & 1 rubygems