Class: LucidShopify::DeleteAllWebhooks
- Inherits:
-
Object
- Object
- LucidShopify::DeleteAllWebhooks
- Defined in:
- lib/lucid_shopify/delete_all_webhooks.rb
Instance Method Summary collapse
-
#call(credentials) ⇒ Array<Hash>
Delete any existing webhooks.
-
#initialize(client: Container[:client], delete_webhook: Container[:delete_webhook]) ⇒ DeleteAllWebhooks
constructor
A new instance of DeleteAllWebhooks.
Constructor Details
#initialize(client: Container[:client], delete_webhook: Container[:delete_webhook]) ⇒ DeleteAllWebhooks
Returns a new instance of DeleteAllWebhooks.
11 12 13 14 15 |
# File 'lib/lucid_shopify/delete_all_webhooks.rb', line 11 def initialize(client: Container[:client], delete_webhook: Container[:delete_webhook]) @client = client @delete_webhook = delete_webhook end |
Instance Method Details
#call(credentials) ⇒ Array<Hash>
Delete any existing webhooks.
24 25 26 27 28 29 30 |
# File 'lib/lucid_shopify/delete_all_webhooks.rb', line 24 def call(credentials) webhooks = @client.get(credentials, 'webhooks')['webhooks'] webhooks.map do |webhook| Thread.new { @delete_webhook.(credentials, webhook['id']) } end.map(&:value) end |