Class: Tremendous::Webhook
- Inherits:
-
Object
- Object
- Tremendous::Webhook
- Defined in:
- lib/tremendous/webhook.rb
Class Method Summary collapse
- .create!(url, data = {}) ⇒ Object
- .events(id) ⇒ Object
- .retrieve(id) ⇒ Object
- .simulate!(id, event, data = {}) ⇒ Object
Class Method Details
.create!(url, data = {}) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/tremendous/webhook.rb', line 3 def self.create!(url, data={}) Tremendous::Request.post( 'webhooks', body: {url: url}.merge(data).to_json, headers: { 'Content-Type' => 'application/json' } )[:webhook] end |
.events(id) ⇒ Object
11 12 13 |
# File 'lib/tremendous/webhook.rb', line 11 def self.events(id) Tremendous::Request.get("webhooks/#{id}/events")[:events] end |
.retrieve(id) ⇒ Object
15 16 17 |
# File 'lib/tremendous/webhook.rb', line 15 def self.retrieve(id) response = Tremendous::Request.get("webhooks/#{id}")[:webhook] end |
.simulate!(id, event, data = {}) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/tremendous/webhook.rb', line 19 def self.simulate!(id, event, data={}) Tremendous::Request.post( "webhooks/#{id}/simulate", body: {event: event}.merge(data).to_json, headers: { 'Content-Type' => 'application/json' } ) end |