Sha256: 76766c6e7f2dc96cbad9cb8deebcd1f5c36f477af336bd5a2c6042c45e32add4

Contents?: true

Size: 560 Bytes

Versions: 14

Compression:

Stored size: 560 Bytes

Contents

class <%= @job_class_name %> < ActiveJob::Base
  extend ShopifyAPI::Webhooks::Handler

  class << self
    def handle(topic:, shop:, body:)
      perform_later(topic: topic, shop_domain: shop, webhook: body)
    end
  end

  def perform(topic:, shop_domain:, webhook:)
    shop = Shop.find_by(shopify_domain: shop_domain)

    if shop.nil?
      logger.error("#{self.class} failed: cannot find shop with domain '#{shop_domain}'")

      raise ActiveRecord::RecordNotFound, "Shop Not Found"
    end

    shop.with_shopify_session do |session|
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
shopify_app-22.3.1 lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt
shopify_app-22.3.0 lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt
shopify_app-22.2.1 lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt
shopify_app-22.2.0 lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt
shopify_app-22.1.0 lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt
shopify_app-22.0.1 lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt
shopify_app-22.00.0 lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt
shopify_app-21.10.0 lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt
shopify_app-21.9.0 lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt
shopify_app-21.8.1 lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt
shopify_app-21.8.0 lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt
shopify_app-21.7.0 lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt
shopify_app-21.6.0 lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt
shopify_app-21.5.0 lib/generators/shopify_app/add_webhook/templates/webhook_job.rb.tt