Class: SimpleSpark::Endpoints::RelayWebhooks
- Inherits:
-
Object
- Object
- SimpleSpark::Endpoints::RelayWebhooks
- Defined in:
- lib/simple_spark/endpoints/relay_webhooks.rb
Overview
Provides access to the /relay-webhooks endpoint See: developers.sparkpost.com/api/#/reference/relay-webhooks
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
-
#create(values) ⇒ Object
Create a relay webhook properties = { name: “Replies Webhook”, target: “webhooks.customer.example/replies”, auth_token: “”, match: { protocol: “SMTP”, domain: “email.example.com” } }.
-
#delete(webhook_id) ⇒ Object
Delete a relay webhook.
-
#initialize(client) ⇒ RelayWebhooks
constructor
A new instance of RelayWebhooks.
-
#list ⇒ Array
Lists your relay webhooks.
-
#retrieve(webhook_id) ⇒ Hash
Retrieve a relay webhook.
-
#update(webhook_id, values) ⇒ Hash
Update a relay webhook properties = { name: “New Replies Webhook”, target: “webhook.customer.example/replies” }.
Constructor Details
#initialize(client) ⇒ RelayWebhooks
Returns a new instance of RelayWebhooks.
8 9 10 |
# File 'lib/simple_spark/endpoints/relay_webhooks.rb', line 8 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
6 7 8 |
# File 'lib/simple_spark/endpoints/relay_webhooks.rb', line 6 def client @client end |
Instance Method Details
#create(values) ⇒ Object
Example:
Create a relay webhook properties = {
name: "Replies Webhook",
target: "https://webhooks.customer.example/replies",
auth_token: "",
match: {
protocol: "SMTP",
domain: "email.example.com"
}
}
32 33 34 |
# File 'lib/simple_spark/endpoints/relay_webhooks.rb', line 32 def create(values) @client.call(method: :post, path: 'relay-webhooks', body_values: values) end |
#delete(webhook_id) ⇒ Object
Delete a relay webhook
61 62 63 |
# File 'lib/simple_spark/endpoints/relay_webhooks.rb', line 61 def delete(webhook_id) @client.call(method: :delete, path: "relay-webhooks/#{webhook_id}") end |
#list ⇒ Array
Lists your relay webhooks
15 16 17 |
# File 'lib/simple_spark/endpoints/relay_webhooks.rb', line 15 def list @client.call(method: :get, path: 'relay-webhooks') end |
#retrieve(webhook_id) ⇒ Hash
Retrieve a relay webhook
40 41 42 |
# File 'lib/simple_spark/endpoints/relay_webhooks.rb', line 40 def retrieve(webhook_id) @client.call(method: :get, path: "relay-webhooks/#{webhook_id}") end |
#update(webhook_id, values) ⇒ Hash
Example:
Update a relay webhook properties =
name: "New Replies Webhook",
target: "https://webhook.customer.example/replies"
54 55 56 |
# File 'lib/simple_spark/endpoints/relay_webhooks.rb', line 54 def update(webhook_id, values) @client.call(method: :put, path: "relay-webhooks/#{webhook_id}", body_values: values) end |