Sha256: 3a44315e74ed36ed78de53cc2baa6f49909fa0ef110726bbc3a0f052cdb53755

Contents?: true

Size: 663 Bytes

Versions: 17

Compression:

Stored size: 663 Bytes

Contents

module ShopifyApp
  class WebhooksController < ApplicationController
    include ShopifyApp::WebhookVerification

    class ShopifyApp::MissingWebhookJobError < StandardError; end

    def receive
      params.try(: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_type.classify}Job".safe_constantize or raise ShopifyApp::MissingWebhookJobError
    end

    def webhook_type
      params[:type]
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
shopify_app-7.4.0 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.3.0 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.2.11 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.2.10 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.2.9 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.2.8 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.2.7 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.2.6 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.2.5 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.2.3 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.2.0 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.1.1 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.1.0 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.0.11 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.0.10 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.0.9 app/controllers/shopify_app/webhooks_controller.rb
shopify_app-7.0.8 app/controllers/shopify_app/webhooks_controller.rb