Class: LucidShopify::CreateAllWebhooks
- Inherits:
-
Object
- Object
- LucidShopify::CreateAllWebhooks
- Defined in:
- lib/lucid_shopify/create_all_webhooks.rb
Instance Method Summary collapse
-
#call(credentials, webhooks: Container[:webhook_list]) ⇒ Array<Hash>
Create all webhooks for the shop.
-
#initialize(create_webhook: Container[:create_webhook]) ⇒ CreateAllWebhooks
constructor
A new instance of CreateAllWebhooks.
Constructor Details
#initialize(create_webhook: Container[:create_webhook]) ⇒ CreateAllWebhooks
Returns a new instance of 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(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(credentials, webhooks: Container[:webhook_list]) webhooks.map do |webhook| Thread.new { @create_webhook.(credentials, webhook) } end.map(&:value) end |