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

Returns a new instance of CreateAllWebhooks.

Parameters:

  • create_webhook (#call) (defaults to: Container[:create_webhook])


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(credentials, webhooks: Container[:webhook_list]) ⇒ Array<Hash>

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

Parameters:

Returns:

  • (Array<Hash>)

    response data



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

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