Class: Trello::Webhook

Inherits:
BasicData show all
Defined in:
lib/trello/webhook.rb

Overview

A webhook is a URL called each time a specified model is updated

Instance Attribute Summary collapse

Attributes inherited from BasicData

#client

Instance Method Summary collapse

Methods inherited from BasicData

#==, #attributes, client, #collection_name, #collection_path, create, #element_name, #element_path, find, #hash, #initialize, many, one, parse, parse_many, path_name, #refresh!, register_attrs, #save, save, schema, #schema, #update!, #update_fields

Methods included from JsonUtils

included

Constructor Details

This class inherits a constructor from Trello::BasicData

Instance Attribute Details

#activeBoolean (readonly)

Returns:

  • (Boolean)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/trello/webhook.rb', line 18

class Webhook < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :consecutive_failures, readonly: true, remote_key: 'consecutiveFailures'
    attribute :first_consecutive_fail_date, readonly: true, remote_key: 'firstConsecutiveFailDate', serializer: 'Time'

    # Writable
    attribute :description
    attribute :model_id, remote_key: 'idModel'
    attribute :callback_url, remote_key: 'callbackURL'
    attribute :active
  end

  validates_presence_of :id, :model_id, :callback_url
  validates_length_of :description, in: 1..16384

  # Delete this webhook
  #
  # @return [String] the JSON response from the Trello API
  def delete
    client.delete("/webhooks/#{id}")
  end

  # Check if the webhook is activated
  #
  # @return [Boolean]
  def activated?
    active
  end
end

#callback_urlString (readonly)

Returns:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/trello/webhook.rb', line 18

class Webhook < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :consecutive_failures, readonly: true, remote_key: 'consecutiveFailures'
    attribute :first_consecutive_fail_date, readonly: true, remote_key: 'firstConsecutiveFailDate', serializer: 'Time'

    # Writable
    attribute :description
    attribute :model_id, remote_key: 'idModel'
    attribute :callback_url, remote_key: 'callbackURL'
    attribute :active
  end

  validates_presence_of :id, :model_id, :callback_url
  validates_length_of :description, in: 1..16384

  # Delete this webhook
  #
  # @return [String] the JSON response from the Trello API
  def delete
    client.delete("/webhooks/#{id}")
  end

  # Check if the webhook is activated
  #
  # @return [Boolean]
  def activated?
    active
  end
end

#consecutive_failuresInteger (readonly)

Returns:

  • (Integer)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/trello/webhook.rb', line 18

class Webhook < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :consecutive_failures, readonly: true, remote_key: 'consecutiveFailures'
    attribute :first_consecutive_fail_date, readonly: true, remote_key: 'firstConsecutiveFailDate', serializer: 'Time'

    # Writable
    attribute :description
    attribute :model_id, remote_key: 'idModel'
    attribute :callback_url, remote_key: 'callbackURL'
    attribute :active
  end

  validates_presence_of :id, :model_id, :callback_url
  validates_length_of :description, in: 1..16384

  # Delete this webhook
  #
  # @return [String] the JSON response from the Trello API
  def delete
    client.delete("/webhooks/#{id}")
  end

  # Check if the webhook is activated
  #
  # @return [Boolean]
  def activated?
    active
  end
end

#descriptionString (readonly)

Returns:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/trello/webhook.rb', line 18

class Webhook < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :consecutive_failures, readonly: true, remote_key: 'consecutiveFailures'
    attribute :first_consecutive_fail_date, readonly: true, remote_key: 'firstConsecutiveFailDate', serializer: 'Time'

    # Writable
    attribute :description
    attribute :model_id, remote_key: 'idModel'
    attribute :callback_url, remote_key: 'callbackURL'
    attribute :active
  end

  validates_presence_of :id, :model_id, :callback_url
  validates_length_of :description, in: 1..16384

  # Delete this webhook
  #
  # @return [String] the JSON response from the Trello API
  def delete
    client.delete("/webhooks/#{id}")
  end

  # Check if the webhook is activated
  #
  # @return [Boolean]
  def activated?
    active
  end
end

#first_consecutive_fail_dateDatetime (readonly)

Returns:

  • (Datetime)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/trello/webhook.rb', line 18

class Webhook < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :consecutive_failures, readonly: true, remote_key: 'consecutiveFailures'
    attribute :first_consecutive_fail_date, readonly: true, remote_key: 'firstConsecutiveFailDate', serializer: 'Time'

    # Writable
    attribute :description
    attribute :model_id, remote_key: 'idModel'
    attribute :callback_url, remote_key: 'callbackURL'
    attribute :active
  end

  validates_presence_of :id, :model_id, :callback_url
  validates_length_of :description, in: 1..16384

  # Delete this webhook
  #
  # @return [String] the JSON response from the Trello API
  def delete
    client.delete("/webhooks/#{id}")
  end

  # Check if the webhook is activated
  #
  # @return [Boolean]
  def activated?
    active
  end
end

#idString (readonly)

Returns:



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/trello/webhook.rb', line 18

class Webhook < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :consecutive_failures, readonly: true, remote_key: 'consecutiveFailures'
    attribute :first_consecutive_fail_date, readonly: true, remote_key: 'firstConsecutiveFailDate', serializer: 'Time'

    # Writable
    attribute :description
    attribute :model_id, remote_key: 'idModel'
    attribute :callback_url, remote_key: 'callbackURL'
    attribute :active
  end

  validates_presence_of :id, :model_id, :callback_url
  validates_length_of :description, in: 1..16384

  # Delete this webhook
  #
  # @return [String] the JSON response from the Trello API
  def delete
    client.delete("/webhooks/#{id}")
  end

  # Check if the webhook is activated
  #
  # @return [Boolean]
  def activated?
    active
  end
end

#model_idString (readonly)

Returns A 24-character hex string.

Returns:

  • (String)

    A 24-character hex string



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/trello/webhook.rb', line 18

class Webhook < BasicData

  schema do
    # Readonly
    attribute :id, readonly: true, primary_key: true
    attribute :consecutive_failures, readonly: true, remote_key: 'consecutiveFailures'
    attribute :first_consecutive_fail_date, readonly: true, remote_key: 'firstConsecutiveFailDate', serializer: 'Time'

    # Writable
    attribute :description
    attribute :model_id, remote_key: 'idModel'
    attribute :callback_url, remote_key: 'callbackURL'
    attribute :active
  end

  validates_presence_of :id, :model_id, :callback_url
  validates_length_of :description, in: 1..16384

  # Delete this webhook
  #
  # @return [String] the JSON response from the Trello API
  def delete
    client.delete("/webhooks/#{id}")
  end

  # Check if the webhook is activated
  #
  # @return [Boolean]
  def activated?
    active
  end
end

Instance Method Details

#activated?Boolean

Check if the webhook is activated

Returns:

  • (Boolean)


46
47
48
# File 'lib/trello/webhook.rb', line 46

def activated?
  active
end

#deleteString

Delete this webhook

Returns:

  • (String)

    the JSON response from the Trello API



39
40
41
# File 'lib/trello/webhook.rb', line 39

def delete
  client.delete("/webhooks/#{id}")
end