Class: Lucid::Shopify::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])


9
10
11
# File 'lib/lucid/shopify/create_all_webhooks.rb', line 9

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.

Parameters:

Returns:

  • (Array<Hash>)

    response data



19
20
21
22
23
# File 'lib/lucid/shopify/create_all_webhooks.rb', line 19

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