Class: ShopifyClient::CreateWebhook
- Inherits:
-
Object
- Object
- ShopifyClient::CreateWebhook
- Defined in:
- lib/shopify-client/create_webhook.rb
Instance Method Summary collapse
Instance Method Details
#call(client, webhook) ⇒ Integer
Returns ID.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/shopify-client/create_webhook.rb', line 11 def call(client, webhook) raise ConfigError, 'webhook_uri is not set' unless ShopifyClient.config.webhook_uri client.post('webhooks', webhook: webhook.merge( address: ShopifyClient.config.webhook_uri, )).data['webhook']['id'] rescue Response::Error => e raise e unless e.response.errors.([ /has already been taken/, ]) end |