Sha256: cec5404ba1d8b3bf006caf40d48600c9e1e7ee2c62e5fe46899960d1041fdb26
Contents?: true
Size: 851 Bytes
Versions: 11
Compression:
Stored size: 851 Bytes
Contents
# frozen_string_literal: true module ShopifyApp class MissingWebhookJobError < StandardError; end class WebhooksController < ActionController::Base include ShopifyApp::WebhookVerification def receive params.permit! webhook_job_klass.perform_later(shop_domain: shop_domain, webhook: webhook_params.to_h) head(:ok) 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
11 entries across 11 versions & 2 rubygems