Ramp.WebhookSubscriptions (ramp v1.0.0)

Copy Markdown View Source

The Webhooks resource: registering, listing, updating, and deleting webhook endpoint subscriptions.

This is distinct from Ramp.Webhooks, which verifies and decodes inbound webhook deliveries -- this module manages which events get sent where.

Known event types

"card.activated", "card.suspended", "card.terminated", "limit.created", "limit.updated", "reimbursement.created", "reimbursement.updated", "transaction.created", "transaction.updated", "user.created", "user.updated", "user.deactivated", "bill.created", "bill.updated", "bill.payment.created", "receipt.created", "receipt.matched".

Summary

Functions

Registers a new webhook endpoint that will receive event_types at url.

Deletes a webhook registration.

Fetches a single webhook registration by ID.

Fetches a single page of webhook registrations. See Ramp.Page.

Updates a webhook registration's URL, active status, and/or subscribed event types.

Types

list_opt()

@type list_opt() :: {:start, String.t()} | {:page_size, pos_integer()}

update_opt()

@type update_opt() ::
  {:url, String.t()} | {:active, boolean()} | {:event_types, [String.t()]}

Functions

create(client, url, event_types, opts \\ [])

@spec create(Ramp.Client.t(), String.t(), [String.t()], keyword()) ::
  {:ok, Ramp.WebhookSubscriptions.Registration.t()} | {:error, Ramp.Error.t()}

Registers a new webhook endpoint that will receive event_types at url.

If you omit :secret_token, Ramp generates one for you and returns it in the response -- capture it immediately (via the returned Registration's secret_token) and store it securely; it's what you'll pass to Ramp.Webhooks.construct_event/5 to verify deliveries.

delete(client, id)

@spec delete(Ramp.Client.t(), String.t()) :: :ok | {:error, Ramp.Error.t()}

Deletes a webhook registration.

get(client, id)

Fetches a single webhook registration by ID.

list(client, opts \\ [])

Returns a lazily auto-paginating Stream of Ramp.WebhookSubscriptions.Registrations.

list_page(client, opts \\ [])

@spec list_page(Ramp.Client.t(), [list_opt()]) ::
  {:ok, Ramp.Page.t(Ramp.WebhookSubscriptions.Registration.t())}
  | {:error, Ramp.Error.t()}

Fetches a single page of webhook registrations. See Ramp.Page.

update(client, id, opts)

@spec update(Ramp.Client.t(), String.t(), [update_opt()]) ::
  {:ok, Ramp.WebhookSubscriptions.Registration.t()} | {:error, Ramp.Error.t()}

Updates a webhook registration's URL, active status, and/or subscribed event types.