Class: ShopifyApp::WebhooksManager
- Inherits:
-
Object
- Object
- ShopifyApp::WebhooksManager
- Defined in:
- lib/shopify_app/webhooks_manager.rb
Defined Under Namespace
Classes: CreationFailed
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.queue(shop_domain, shop_token) ⇒ Object
5 6 7 |
# File 'lib/shopify_app/webhooks_manager.rb', line 5 def self.queue(shop_domain, shop_token) ShopifyApp::WebhooksManagerJob.perform_later(shop_domain: shop_domain, shop_token: shop_token) end |
Instance Method Details
#create_webhooks ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/shopify_app/webhooks_manager.rb', line 14 def create_webhooks return unless required_webhooks.present? required_webhooks.each do |webhook| create_webhook(webhook) unless webhook_exists?(webhook[:topic]) end end |
#destroy_webhooks ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/shopify_app/webhooks_manager.rb', line 22 def destroy_webhooks ShopifyAPI::Webhook.all.each do |webhook| ShopifyAPI::Webhook.delete(webhook.id) if is_required_webhook?(webhook) end @current_webhooks = nil end |
#recreate_webhooks! ⇒ Object
9 10 11 12 |
# File 'lib/shopify_app/webhooks_manager.rb', line 9 def recreate_webhooks! destroy_webhooks create_webhooks end |