class Contentful::Management::Webhook

Resource class for Webhook. @see _ www.contentful.com/developers/documentation/content-management-api/http/#resources-webhooks

Public Class Methods

create(client, space_id, attributes = {}) click to toggle source

Creates a webhook.

@param [Contentful::Management::Client] client @param [String] space_id @param [Hash] attributes @see _ README for full attribute list for each resource.

@return [Contentful::Management::Webhook]

Calls superclass method
# File lib/contentful/management/webhook.rb, line 43
def self.create(client, space_id, attributes = {})
  super(client, space_id, nil, attributes)
end
create_attributes(_client, attributes) click to toggle source

@private

# File lib/contentful/management/webhook.rb, line 30
def self.create_attributes(_client, attributes)
  keys = %i[httpBasicUsername httpBasicPassword url name headers topics filters transformation]
  attributes.select { |key, _value| keys.include? key }
end
endpoint() click to toggle source

@private

# File lib/contentful/management/webhook.rb, line 25
def self.endpoint
  'webhook_definitions'
end
find(client, space_id, webhook_id) click to toggle source

Finds a webhook by ID.

@param [Contentful::Management::Client] client @param [String] space_id @param [String] webhook_id

@return [Contentful::Management::Webhook]

Calls superclass method
# File lib/contentful/management/webhook.rb, line 54
def self.find(client, space_id, webhook_id)
  super(client, space_id, nil, webhook_id)
end

Public Instance Methods

webhook_calls() click to toggle source

Allows manipulation of webhook call details in context of the current webhook Allows listing all webhook call details for the webhook and finding one by ID. @see _ README for details.

@return [Contentful::Management::WebhookWebhookCallMethodsFactory]

# File lib/contentful/management/webhook.rb, line 63
def webhook_calls
  WebhookWebhookCallMethodsFactory.new(self)
end
webhook_health() click to toggle source

Allows manipulation of webhook health details in context of the current webhook Allows listing webhook health details for the webhook. @see _ README for details.

@return [Contentful::Management::WebhookWebhookHealthMethodsFactory]

# File lib/contentful/management/webhook.rb, line 72
def webhook_health
  WebhookWebhookHealthMethodsFactory.new(self)
end

Protected Instance Methods

query_attributes(attributes) click to toggle source
# File lib/contentful/management/webhook.rb, line 78
def query_attributes(attributes)
  self.class.create_attributes(
    nil,
    {
      url: url,
      name: name,
      topics: topics,
      headers: headers,
      httpBasicUsername: http_basic_username,
      filters: filters,
      transformation: transformation
    }.merge(attributes)
  )
end