module MailerLite::Clients::Webhooks
Public Instance Methods
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
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
@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
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
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