Class: Emites::Resources::Webhook
- Defined in:
- lib/emites/resources/webhook.rb
Overview
A wrapper to Emites webhooks API
- API
-
Documentation: myfreecomm.github.io/emites/sandbox/v1/modules/webhooks.html
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#create(params) ⇒ Emites::Entities::Webhook
Creates an Webhook.
-
#destroy(id) ⇒ Boolean
Deletes an Webhook by it’s id.
-
#list ⇒ Array
Lists all Webhooks related to the account.
-
#update(id, params) ⇒ Array
Updates an Webhook identified by
id
.
Methods inherited from Base
Methods included from Hooks
Constructor Details
This class inherits a constructor from Emites::Resources::Base
Instance Method Details
#create(params) ⇒ Emites::Entities::Webhook
Creates an Webhook
- API
-
Method:
POST /api/v1/webhooks
Documentation: myfreecomm.github.io/emites/sandbox/v1/modules/webhooks.html#criacao
75 76 77 78 79 |
# File 'lib/emites/resources/webhook.rb', line 75 def create(params) http.post("/webhooks", { body: params }) do |response| respond_with_entity(response) end end |
#destroy(id) ⇒ Boolean
Deletes an Webhook by it’s id. Returns true</true> if deletion performed well, otherwise, returns <tt>false
.
- API
-
Method:
DELETE /api/v1/webhooks/:id
Documentation: myfreecomm.github.io/emites/sandbox/v1/modules/webhooks.html#remocao
60 61 62 63 64 |
# File 'lib/emites/resources/webhook.rb', line 60 def destroy(id) http.delete("/webhooks/#{id}") do |response| response.code == 204 end end |
#list ⇒ Array
Lists all Webhooks related to the account
- API
-
Method:
GET /api/v1/webhooks
Documentation: myfreecomm.github.io/emites/sandbox/v1/modules/webhooks.html#listagem
28 29 30 31 32 |
# File 'lib/emites/resources/webhook.rb', line 28 def list http.get("/webhooks") do |response| respond_with_collection(response) end end |
#update(id, params) ⇒ Array
Updates an Webhook identified by id
- API
-
Method:
PUT /api/v1/webhooks/:id
Documentation: myfreecomm.github.io/emites/sandbox/v1/modules/webhooks.html#atualizacao
44 45 46 47 48 |
# File 'lib/emites/resources/webhook.rb', line 44 def update(id, params) http.put("/webhooks/#{id}", { body: params }) do |response| respond_with_entity(response) end end |