stripe-ruby/lib/stripe/resources/webhook_endpoint.rb
stripe-openapi[bot] da6422f0a0
Update generated code (#1387)
* Update generated code for v979

* Update generated code for v985

* Update generated code for v989

* Update generated code for v997

* Update generated code for v1002

* Update generated code for v1003

* Update generated code for v1005

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: prathmesh-stripe <165320323+prathmesh-stripe@users.noreply.github.com>
2024-05-02 16:31:03 -04:00

74 lines
2.9 KiB
Ruby

# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# You can configure [webhook endpoints](https://docs.stripe.com/webhooks/) via the API to be
# notified about events that happen in your Stripe account or connected
# accounts.
#
# Most users configure webhooks from [the dashboard](https://dashboard.stripe.com/webhooks), which provides a user interface for registering and testing your webhook endpoints.
#
# Related guide: [Setting up webhooks](https://docs.stripe.com/webhooks/configure)
class WebhookEndpoint < APIResource
extend Stripe::APIOperations::Create
include Stripe::APIOperations::Delete
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
OBJECT_NAME = "webhook_endpoint"
def self.object_name
"webhook_endpoint"
end
# A webhook endpoint must have a url and a list of enabled_events. You may optionally specify the Boolean connect parameter. If set to true, then a Connect webhook endpoint that notifies the specified url about events from all connected accounts is created; otherwise an account webhook endpoint that notifies the specified url only about events from your account is created. You can also create webhook endpoints in the [webhooks settings](https://dashboard.stripe.com/account/webhooks) section of the Dashboard.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/webhook_endpoints",
params: params,
opts: opts
)
end
# You can also delete webhook endpoints via the [webhook endpoint management](https://dashboard.stripe.com/account/webhooks) page of the Stripe dashboard.
def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/webhook_endpoints/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# You can also delete webhook endpoints via the [webhook endpoint management](https://dashboard.stripe.com/account/webhooks) page of the Stripe dashboard.
def delete(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/webhook_endpoints/%<webhook_endpoint>s", { webhook_endpoint: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Returns a list of your webhook endpoints.
def self.list(filters = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/webhook_endpoints",
params: filters,
opts: opts
)
end
# Updates the webhook endpoint. You may edit the url, the list of enabled_events, and the status of your endpoint.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/webhook_endpoints/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
end
end