module MailerLite::Clients::Webhooks

MailerLite Webhooks

Public Instance Methods

create_webhook(url, event) click to toggle source

Create webhook

@see developers.mailerlite.com/v2/reference#webhooks-2

@param url [String] Your URL where callbacks are sent. @param event [String] Subscribed event.

@return [Hash] Response from API.

# File lib/mailerlite/clients/webhooks.rb, line 35
def create_webhook(url, event)
  connection.post('webhooks', url: url, event: event)
end
delete_webhook(id) click to toggle source

Remove webhook

@see developers.mailerlite.com/v2/reference#webhooksid-2

@param id [Integer] ID of webhook.

@return [Hash] Response from API.

# File lib/mailerlite/clients/webhooks.rb, line 60
def delete_webhook(id)
  connection.delete("webhooks/#{id}")
end
update_webhook(id, options = {}) click to toggle source

Update webhook

@see developers.mailerlite.com/v2/reference#webhooksid-1

@param id [Integer] ID of webhook. @param options [Hash] A customizable set of options. @option options [String] :url Your URL where callbacks are sent @option options [String] :event Subscribed event

@return [Hash] Response from API.

# File lib/mailerlite/clients/webhooks.rb, line 49
def update_webhook(id, options = {})
  connection.put("webhooks/#{id}", options)
end
webhook(id) click to toggle source

Get single webhook

@see developers.mailerlite.com/v2/reference#webhooksid

@param id [Integer] ID of a webhook

@return [Hash] Response from API.

# File lib/mailerlite/clients/webhooks.rb, line 23
def webhook(id)
  connection.get("webhooks/#{id}")
end
webhooks() click to toggle source

Get webhooks

@see developers.mailerlite.com/v2/reference#webhooks-1

@return [Hash] Response from API.

# File lib/mailerlite/clients/webhooks.rb, line 12
def webhooks
  connection.get('webhooks')
end