Module: Tacokit::Client::Webhooks

Included in:
Tacokit::Client
Defined in:
lib/tacokit/client/webhooks.rb

Overview

Methods for the Webhooks API

See Also:

Instance Method Summary (collapse)

Instance Method Details

- (Tacokit::Resource<Webhook>) create_webhook(model_id, callback_url, options = {})

Create a webhook

Examples:

Create a webhook for a board

board = Tacokit.boards.first
Tacokit.create_webhook(board.id, "https://example.com/board/callback",
  desc: "My first Trello webhook!") #=> Tacokit::Resource<Webhook>

Parameters:

  • model_id (String)

    the id of the model that should be webhooked

  • callback_url (String)

    a url reachable with a HEAD request

  • options (String) (defaults to: {})

    options to create the webhook with

Returns:

See Also:



27
28
29
30
31
32
# File 'lib/tacokit/client/webhooks.rb', line 27

def create_webhook(model_id, callback_url, options = {})
  options.update \
    model_id: model_id,
    callback_url: callback_url
  post "webhooks", options
end

- (Object) delete_webhook(webhook_id)

Delete a webhook

Parameters:

  • webhook_id (String)

    the webhook identifier

See Also:



37
38
39
# File 'lib/tacokit/client/webhooks.rb', line 37

def delete_webhook(webhook_id)
  delete webhook_path(webhook_id)
end

- (Tacokit::Resource<Webhook>) update_webhook(webhook_id, options = {})

Update a webhook

Examples:

Update webhook description

Tacokit.update_webhook(webhook.id, desc: "Here's the real webhook description") #=> Tacokit::Resource<Webhook>

Parameters:

  • webhook_id (String)

    the webhook identifier

  • options (Hash) (defaults to: {})

    options to update the webhook with

Returns:

See Also:



13
14
15
# File 'lib/tacokit/client/webhooks.rb', line 13

def update_webhook(webhook_id, options = {})
  put webhook_path(webhook_id), options
end