lib/gocardless_pro/webhook.rb
# Validates that a webhook was genuinely sent by GoCardless using
# `.signature_valid?`, and then parses it into an array of
# `GoCardlessPro::Resources::Event` objects representing each event
# included in the webhook
#
# @option options [String] :request_body the request body
# @option options [String] :signature_header the signature included in the request,
#   found in the `Webhook-Signature` header
# @option options [String] :webhook_endpoint_secret the webhook endpoint secret for
#   your webhook endpoint, as configured in your GoCardless Dashboard
# @return [Array<GoCardlessPro::Resources::Event>] the events included
#   in the webhook
# @raise [InvalidSignatureError] if the signature header specified does not match
#   the signature computed using the request body and webhook endpoint secret
# @raise [ArgumentError] if a required keyword argument is not provided or is not
#   of the required type
Validates that a webhook was genuinely sent by GoCardless using
`.signature_valid?`, and then parses it into an array of
`GoCardlessPro::Resources::Event` objects representing each event
included in the webhook
Validates that a webhook was genuinely sent by GoCardless using ` . signature_valid? ` and then parses it into an array of ` GoCardlessPro :: Resources :: Event ` objects representing each event included in the webhook
def validate_options!(options)
        unless options[:request_body].is_a?(String)
          raise ArgumentError, 'request_body must be provided and must be a string'
        end
        unless options[:signature_header].is_a?(String)
          raise ArgumentError, 'signature_header must be provided and must be a string'
        end
        unless options[:webhook_endpoint_secret].is_a?(String)
          raise ArgumentError, 'webhook_endpoint_secret must be provided and must be a ' \
                               'string'
        end
      end
def validate_options! ( options ) unless options [ :request_body ] . is_a? ( String ) raise ArgumentError , 'request_body must be provided and must be a string' end unless options [ :signature_header ] . is_a? ( String ) raise ArgumentError , 'signature_header must be provided and must be a string' end unless options [ :webhook_endpoint_secret ] . is_a? ( String ) raise ArgumentError , 'webhook_endpoint_secret must be provided and must be a ' 'string' end end
Validates that a webhook was genuinely sent by GoCardless using
`.signature_valid?`, and then parses it into an array of
`GoCardlessPro::Resources::Event` objects representing each event
included in the webhook
Validates that a webhook was genuinely sent by GoCardless using ` . signature_valid? ` and then parses it into an array of ` GoCardlessPro :: Resources :: Event ` objects representing each event included in the webhook
the events included in the webhook
the events included in the webhook
Array<GoCardlessPro::Resources::Event>
[InvalidSignatureError] if the signature header specified does not match the signature computed using the request body and webhook endpoint secret
[ InvalidSignatureError ] if the signature header specified does not match the signature computed using the request body and webhook endpoint secret
[ArgumentError] if a required keyword argument is not provided or is not of the required type
[ ArgumentError ] if a required keyword argument is not provided or is not of the required type
options
:webhook_endpoint_secret the webhook endpoint secret for your webhook endpoint, as configured in your GoCardless Dashboard
: webhook_endpoint_secret the webhook endpoint secret for your webhook endpoint as configured in your GoCardless Dashboard