Class: ModerationAPI::Resources::WebhookSecret

Inherits:
Object
  • Object
show all
Defined in:
lib/moderation_api/resources/webhook_secret.rb,
sig/moderation_api/resources/webhook_secret.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ WebhookSecret

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 WebhookSecret.

Parameters:



29
30
31
# File 'lib/moderation_api/resources/webhook_secret.rb', line 29

def initialize(client:)
  @client = client
end

Instance Method Details

#retrieve(request_options: {}) ⇒ ModerationAPI::Models::WebhookSecretRetrieveResponse

Get the signing secret used to sign webhook deliveries for this project, creating one if none exists yet. Verify deliveries by comparing the modapi-signature header to HMAC-SHA256(raw request body, secret) hex-encoded.

Parameters:

Returns:

See Also:



17
18
19
20
21
22
23
24
# File 'lib/moderation_api/resources/webhook_secret.rb', line 17

def retrieve(params = {})
  @client.request(
    method: :get,
    path: "webhook-secret",
    model: ModerationAPI::Models::WebhookSecretRetrieveResponse,
    options: params[:request_options]
  )
end