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>
(also: #create)
Creates a webhook in the account.
-
#delete_webhook(account_id, webhook_id, options = {}) ⇒ Dnsimple::Response<nil>
(also: #delete)
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, #list_webhooks)
Lists ALL the webhooks in the account.
Instance Method Details
#create_webhook(account_id, attributes, options = {}) ⇒ Dnsimple::Response<Dnsimple::Struct::Webhook> Also known as: create
Creates a webhook in the account.
35 36 37 38 39 40 |
# File 'lib/dnsimple/client/webhooks.rb', line 35 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> Also known as: delete
Deletes a webook from the account.
WARNING: this cannot be undone.
73 74 75 76 77 |
# File 'lib/dnsimple/client/webhooks.rb', line 73 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.
54 55 56 57 58 |
# File 'lib/dnsimple/client/webhooks.rb', line 54 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, list_webhooks
Lists ALL the webhooks in the account.
17 18 19 20 21 |
# File 'lib/dnsimple/client/webhooks.rb', line 17 def webhooks(account_id, = {}) response = client.get(Client.versioned("/%s/webhooks" % [account_id]), ) Dnsimple::CollectionResponse.new(response, response["data"].map { |r| Struct::Webhook.new(r) }) end |