Class: Shirtsio::Status::Webhook
- Defined in:
- lib/shirtsio/status.rb
Overview
Provides the ability to have status updates pushed to a URL.
Class Method Summary collapse
-
.create(url) ⇒ Boolean
Register a new webhook URL.
-
.delete(url) ⇒ Boolean
Delete a registered webhook URL.
-
.list ⇒ Shirtsio::Status::Webhook
Retrieve all registered webhook URLs.
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the current webhook.
Methods inherited from Endpoint
#initialize, #method_missing, #respond_to?
Constructor Details
This class inherits a constructor from Shirtsio::Endpoint
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Shirtsio::Endpoint
Class Method Details
.create(url) ⇒ Boolean
Register a new webhook URL.
44 45 46 |
# File 'lib/shirtsio/status.rb', line 44 def self.create(url) Shirtsio.post('/webhooks/register/', { :url => url })[:success] end |
.delete(url) ⇒ Boolean
Delete a registered webhook URL.
68 69 70 |
# File 'lib/shirtsio/status.rb', line 68 def self.delete(url) Shirtsio.post('/webhooks/delete/', { :url => url })[:success] end |
.list ⇒ Shirtsio::Status::Webhook
Retrieve all registered webhook URLs.
52 53 54 55 56 57 58 59 60 61 |
# 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 |