class Contentful::Webhook::Listener::BaseWebhook

Attributes

event[R]
id[R]
kind[R]
name[R]
origin[R]
raw_body[R]
raw_headers[R]
raw_topic[R]
space_id[R]
sys[R]

Public Class Methods

new(headers, body) click to toggle source
# File lib/contentful/webhook/listener/webhooks.rb, line 39
def initialize(headers, body)
  @raw_topic = headers[::Contentful::Webhook::Listener::WebhookConstants::WEBHOOK_TOPIC]
  @name = headers[::Contentful::Webhook::Listener::WebhookConstants::WEBHOOK_NAME]
  @origin, @kind, @event = @raw_topic.split('.')
  @raw_body = body
  @raw_headers = headers
  @sys = body['sys']
  @id = sys['id']
  @space_id = sys['space']['sys']['id']
end

Public Instance Methods

asset?() click to toggle source
# File lib/contentful/webhook/listener/webhooks.rb, line 54
def asset?
  kind == 'Asset'
end
content_type?() click to toggle source
# File lib/contentful/webhook/listener/webhooks.rb, line 58
def content_type?
  kind == 'ContentType'
end
entry?() click to toggle source
# File lib/contentful/webhook/listener/webhooks.rb, line 50
def entry?
  kind == 'Entry'
end