class LucidShopify::CreateAllWebhooks

Public Class Methods

new(create_webhook: Container[:create_webhook]) click to toggle source

@param create_webhook [#call]

# File lib/lucid_shopify/create_all_webhooks.rb, line 10
def initialize(create_webhook: Container[:create_webhook])
  @create_webhook = create_webhook
end

Public Instance Methods

call(credentials, webhooks: Container[:webhook_list]) click to toggle source

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

@param credentials [Credentials] @param webhooks [WebhookList]

@return [Array<Hash>] response data

# 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