Module: Dnsimple::Client::Webhooks
- Included in:
- WebhooksService
- Defined in:
- lib/dnsimple/client/webhooks.rb
Instance Method Summary collapse
-
#create_webhook(account_id, attributes, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::Webhook>
Creates a webhook in the account.
-
#delete_webhook(account_id, webhook_id, options = {}) ⇒ Dnsimple::Response<nil>
Deletes a webook from the account.
-
#webhook(account_id, webhook_id, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::Webhook>
Gets a webhook from the account.
-
#webhooks(account_id, options = {}) ⇒ Dnsimple::CollectionResponse<Dnsimple::Struct::Webhook>
(also: #list_webhooks)
Lists ALL the webhooks in the account.
Instance Method Details
#create_webhook(account_id, attributes, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::Webhook>
Creates a webhook in the account.
45 46 47 48 49 50 |
# File 'lib/dnsimple/client/webhooks.rb', line 45 def create_webhook(account_id, attributes, = {}) Extra.validate_mandatory_attributes(attributes, [:url]) response = client.post(Client.versioned("/%s/webhooks" % [account_id]), attributes, ) Dnsimple::Response.new(response, Struct::Webhook.new(response["data"])) end |
#delete_webhook(account_id, webhook_id, options = {}) ⇒ Dnsimple::Response<nil>
Deletes a webook from the account.
WARNING: this cannot be undone.
82 83 84 85 86 |
# File 'lib/dnsimple/client/webhooks.rb', line 82 def delete_webhook(account_id, webhook_id, = {}) response = client.delete(Client.versioned("/%s/webhooks/%s" % [account_id, webhook_id]), nil, ) Dnsimple::Response.new(response, nil) end |
#webhook(account_id, webhook_id, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::Webhook>
Gets a webhook from the account.
63 64 65 66 67 |
# File 'lib/dnsimple/client/webhooks.rb', line 63 def webhook(account_id, webhook_id, = {}) response = client.get(Client.versioned("/%s/webhooks/%s" % [account_id, webhook_id]), ) Dnsimple::Response.new(response, Struct::Webhook.new(response["data"])) end |
#webhooks(account_id, options = {}) ⇒ Dnsimple::CollectionResponse<Dnsimple::Struct::Webhook> Also known as: list_webhooks
Lists ALL the webhooks in the account.
28 29 30 31 32 |
# File 'lib/dnsimple/client/webhooks.rb', line 28 def webhooks(account_id, = {}) response = client.get(Client.versioned("/%s/webhooks" % [account_id]), Options::ListOptions.new()) Dnsimple::CollectionResponse.new(response, response["data"].map { |r| Struct::Webhook.new(r) }) end |