Class: Anthropic::Resources::Beta::Webhooks
- Inherits:
-
Object
- Object
- Anthropic::Resources::Beta::Webhooks
- Defined in:
- lib/anthropic/resources/beta/webhooks.rb
Instance Method Summary collapse
-
#initialize(client:) ⇒ Webhooks
constructor
private
A new instance of Webhooks.
- #unwrap(payload, headers:, key: @client.webhook_key) ⇒ Anthropic::Models::Beta::UnwrapWebhookEvent
Constructor Details
#initialize(client:) ⇒ Webhooks
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Webhooks.
28 29 30 |
# File 'lib/anthropic/resources/beta/webhooks.rb', line 28 def initialize(client:) @client = client end |
Instance Method Details
#unwrap(payload, headers:, key: @client.webhook_key) ⇒ Anthropic::Models::Beta::UnwrapWebhookEvent
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/anthropic/resources/beta/webhooks.rb', line 14 def unwrap(payload, headers:, key: @client.webhook_key) if key.nil? raise ArgumentError.new("Cannot verify a webhook without a key on either the client's webhook_key or passed in as an argument") end ::StandardWebhooks::Webhook.new(key).verify(payload, headers) parsed = JSON.parse(payload, symbolize_names: true) Anthropic::Internal::Type::Converter.coerce(Anthropic::Models::Beta::UnwrapWebhookEvent, parsed) end |