Class: ShopifyClient::CreateAllWebhooks
- Inherits:
-
Object
- Object
- ShopifyClient::CreateAllWebhooks
- Defined in:
- lib/shopify-client/create_all_webhooks.rb
Instance Method Summary collapse
-
#call(client) ⇒ Array<Hash>
Create all registered webhooks for a shop.
Instance Method Details
#call(client) ⇒ Array<Hash>
Create all registered webhooks for a shop.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/shopify-client/create_all_webhooks.rb', line 10 def call(client) create_webhook = CreateWebhook.new ShopifyClient.webhooks.map do |topic, | Thread.new do webhook = {}.tap do |webhook| webhook[:topic] = topic webhook[:fields] = [:fields] unless [:fields].empty? end create_webhook.(client, webhook) end end.map(&:value) end |