Class: Lucid::Shopify::DeleteAllWebhooks
- Inherits:
-
Object
- Object
- Lucid::Shopify::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.
10 11 12 13 14 |
# File 'lib/lucid/shopify/delete_all_webhooks.rb', line 10 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.
21 22 23 24 25 26 27 |
# File 'lib/lucid/shopify/delete_all_webhooks.rb', line 21 def call(credentials) webhooks = @client.get(credentials, 'webhooks')['webhooks'] webhooks.map do |webhook| Thread.new { @delete_webhook.(credentials, webhook['id']) } end.map(&:value) end |