Class: LucidShopify::CreateAllWebhooks

Inherits:
Object
  • Object
show all
Defined in:
lib/lucid_shopify/create_all_webhooks.rb

Instance Method Summary collapse

Constructor Details

#initialize(create_webhook: Container[:create_webhook]) ⇒ CreateAllWebhooks



10
11
12
# File 'lib/lucid_shopify/create_all_webhooks.rb', line 10

def initialize(create_webhook: Container[:create_webhook])
  @create_webhook = create_webhook
end

Instance Method Details

#call(request_credentials, webhooks: Container[:webhook_list]) ⇒ Array<Hash>

Create all webhooks for the shop. Shopify ignores any webhooks which already exist remotely.



23
24
25
26
27
# File 'lib/lucid_shopify/create_all_webhooks.rb', line 23

def call(request_credentials, webhooks: Container[:webhook_list])
  webhooks.map do |webhook|
    Thread.new { @create_webhook.(request_credentials, webhook) }
  end.map(&:value)
end