Module: Particle::Client::Webhooks
- Included in:
- Particle::Client
- Defined in:
- lib/particle/client/webhooks.rb
Overview
Client methods for the Particle webhook API
Instance Method Summary collapse
-
#create_webhook(options) ⇒ Webhook
Creates a new Particle webhook.
-
#remove_webhook(target) ⇒ boolean
Remove a Particle webhook.
-
#webhook(target) ⇒ Webhook
Create a domain model for a Particle webhook.
-
#webhook_attributes(target) ⇒ Hash
Get information about a Particle webhook.
-
#webhooks ⇒ Array<Webhook>
List all Particle webhooks on the account.
Instance Method Details
#create_webhook(options) ⇒ Webhook
Creates a new Particle webhook
48 49 50 51 |
# File 'lib/particle/client/webhooks.rb', line 48 def create_webhook() result = post(Webhook.create_path, ) webhook(result) end |
#remove_webhook(target) ⇒ boolean
Remove a Particle webhook
57 58 59 60 |
# File 'lib/particle/client/webhooks.rb', line 57 def remove_webhook(target) result = delete(webhook(target).path) result[:ok] end |
#webhook(target) ⇒ Webhook
Create a domain model for a Particle webhook
15 16 17 18 19 20 21 |
# File 'lib/particle/client/webhooks.rb', line 15 def webhook(target) if target.is_a? Webhook target else Webhook.new(self, target) end end |
#webhook_attributes(target) ⇒ Hash
Get information about a Particle webhook
The Particle cloud will send a test message to the webhook URL when this is called
39 40 41 |
# File 'lib/particle/client/webhooks.rb', line 39 def webhook_attributes(target) get(webhook(target).path) end |