class SimpleSpark::Endpoints::RelayWebhooks

Provides access to the /relay-webhooks endpoint See: developers.sparkpost.com/api/#/reference/relay-webhooks

Attributes

client[RW]

Public Class Methods

new(client) click to toggle source
# File lib/simple_spark/endpoints/relay_webhooks.rb, line 8
def initialize(client)
  @client = client
end

Public Instance Methods

create(values) click to toggle source

Create a relay webhook @param values [Hash] the values to create with @note See: developers.sparkpost.com/api/#/reference/relay-webhooks/create-and-list/create-a-relay-webhook @note Example: properties = {

name: "Replies Webhook",
target: "https://webhooks.customer.example/replies",
auth_token: "",
match: {
  protocol: "SMTP",
  domain: "email.example.com"
}

}

# 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) click to toggle source

Delete a relay webhook @param webhook_id [String] the id to retrieve @note See: developers.sparkpost.com/api/#/reference/relay-webhooks/retrieve-update-and-delete/delete-a-relay-webhook

# 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() click to toggle source

Lists your relay webhooks @return [Array] a list of Relay Webhook hash objects @note See: developers.sparkpost.com/api/#/reference/relay-webhooks/create-and-list/list-all-relay-webhooks

# File lib/simple_spark/endpoints/relay_webhooks.rb, line 15
def list
  @client.call(method: :get, path: 'relay-webhooks')
end
retrieve(webhook_id) click to toggle source

Retrieve a relay webhook @param webhook_id [String] the id to retrieve @return [Hash] an Relay Webhook hash object @note See: developers.sparkpost.com/api/#/reference/relay-webhooks/retrieve-update-and-delete/retrieve-a-relay-webhook

# 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) click to toggle source

Update a relay webhook @param webhook_id [String] the id to retrieve @param values [Hash] the values to update the relay webhook with @return [Hash] an Relay Webhook hash object @note Example: properties = {

name: "New Replies Webhook",
target: "https://webhook.customer.example/replies"

} @note See: developers.sparkpost.com/api/#/reference/relay-webhooks/create-and-list/update-a-relay-webhook

# 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