class Shirtsio::Status::Webhook
Provides the ability to have status updates pushed to a URL.
Public Class Methods
Register a new webhook URL.
@param [String] url URL status updates will be pushed to @return [Boolean] true if successful; otherwise false @see www.shirts.io/docs/status_reference/#webhooks_section
# File lib/shirtsio/status.rb, line 44 def self.create(url) Shirtsio.post('/webhooks/register/', { :url => url })[:success] end
Delete a registered webhook URL.
@param [String] url URL of webhook to be removed @return [Boolean] true if successful; otherwise false @see www.shirts.io/docs/status_reference/#webhooks_section
# File lib/shirtsio/status.rb, line 68 def self.delete(url) Shirtsio.post('/webhooks/delete/', { :url => url })[:success] end
Retrieve all registered webhook URLs.
@return [Shirtsio::Status::Webhook] a list of registered webhook URLs @see www.shirts.io/docs/status_reference/#webhooks_section
# File lib/shirtsio/status.rb, line 52 def self.list webhooks = [] response = new(Shirtsio.get('/webhooks/list/')) if response.respond_to?(:listener_url) response.listener_url.each do |webhook| webhooks << new({ :url => webhook }) end end webhooks end
Public Instance Methods
Delete the current webhook.
@return [Boolean] true if successful; otherwise false; @see www.shirts.io/docs/status_reference/#webhooks_section
# File lib/shirtsio/status.rb, line 35 def delete Webhook.delete(url) end