class MessagebusWebhookClient

Constants

EVENT_TYPE_MESSAGE_ACCEPT
EVENT_TYPE_MESSAGE_ATTEMPT
EVENT_TYPE_MESSAGE_BOUNCE
EVENT_TYPE_MESSAGE_DEFERRAL
EVENT_TYPE_MESSAGE_OPEN
EVENT_TYPE_RECIPIENT_BLOCK
EVENT_TYPE_RECIPIENT_COMPLAINT
EVENT_TYPE_RECIPIENT_UNSUBSCRIBE

Public Class Methods

new(api_key, api_endpoint = DEFAULT_API_ENDPOINT) click to toggle source
Calls superclass method MessagebusSDK::MessagebusBase::new
# File lib/messagebus-sdk/webhook_client.rb, line 29
def initialize(api_key, api_endpoint = DEFAULT_API_ENDPOINT)
  super(api_key, api_endpoint)
  @rest_endpoints = define_rest_endpoints
end

Public Instance Methods

create(params) click to toggle source
# File lib/messagebus-sdk/webhook_client.rb, line 44
def create(params)
  path = "#{@rest_endpoints[:webhooks]}"
  make_api_request(path, HTTP_POST, params.to_json)
end
delete(webhook_key) click to toggle source
# File lib/messagebus-sdk/webhook_client.rb, line 54
def delete(webhook_key)
  path =  replace_webhook_key("#{@rest_endpoints[:webhook]}", webhook_key)
  make_api_request(path, HTTP_DELETE)
end
update(webhook_key, params) click to toggle source
# File lib/messagebus-sdk/webhook_client.rb, line 49
def update(webhook_key, params)
  path =  replace_webhook_key("#{@rest_endpoints[:webhook]}", webhook_key)
  make_api_request(path, HTTP_PUT, params.to_json)
end
webhook(webhook_key) click to toggle source
# File lib/messagebus-sdk/webhook_client.rb, line 39
def webhook(webhook_key)
  path =  replace_webhook_key("#{@rest_endpoints[:webhook]}", webhook_key)
  make_api_request(path, HTTP_GET)
end
webhooks() click to toggle source
# File lib/messagebus-sdk/webhook_client.rb, line 34
def webhooks
  path = "#{@rest_endpoints[:webhooks]}"
  make_api_request(path, HTTP_GET)
end

Private Instance Methods

define_rest_endpoints() click to toggle source
# File lib/messagebus-sdk/webhook_client.rb, line 61
def define_rest_endpoints
  {
    :webhooks => "/v5/webhooks",
    :webhook => "/v5/webhook/%WEBHOOK_KEY%"
  }
end