Module: Hooksmith
- Defined in:
- lib/hooksmith.rb,
lib/hooksmith/errors.rb,
lib/hooksmith/logger.rb,
lib/hooksmith/railtie.rb,
lib/hooksmith/request.rb,
lib/hooksmith/version.rb,
lib/hooksmith/dispatcher.rb,
lib/hooksmith/idempotency.rb,
lib/hooksmith/configuration.rb,
lib/hooksmith/event_recorder.rb,
lib/hooksmith/processor/base.rb,
lib/hooksmith/verifiers/base.rb,
lib/hooksmith/verifiers/hmac.rb,
lib/hooksmith/config/provider.rb,
lib/hooksmith/instrumentation.rb,
lib/hooksmith/config/event_store.rb,
lib/hooksmith/jobs/dispatcher_job.rb,
lib/hooksmith/verifiers/bearer_token.rb,
lib/hooksmith/rails/webhooks_controller.rb
Overview
Provides a DSL for registering webhook processors by provider and event.
Defined Under Namespace
Modules: Config, EventRecorder, Idempotency, Instrumentation, Jobs, Processor, Rails, Verifiers Classes: Configuration, ConfigurationError, Dispatcher, Error, InvalidPayloadError, Logger, MultipleProcessorsError, NoProcessorError, PersistenceError, ProcessorError, Railtie, Request, UnknownEventError, VerificationError
Constant Summary collapse
- VERSION =
'1.0.0'
Class Method Summary collapse
-
.configuration ⇒ Configuration
Returns the configuration instance.
-
.configure {|config| ... } ⇒ Object
Yields the configuration to a block.
-
.logger ⇒ Logger
Returns the gem's logger instance.
-
.verifier_configured?(provider) ⇒ Boolean
Checks if a provider has a verifier configured.
-
.verify!(provider:, request:) ⇒ void
Verifies an incoming webhook request for a provider.
Class Method Details
.configuration ⇒ Configuration
Returns the configuration instance.
55 56 57 |
# File 'lib/hooksmith.rb', line 55 def self.configuration @configuration ||= Configuration.new end |
.configure {|config| ... } ⇒ Object
Yields the configuration to a block.
61 62 63 |
# File 'lib/hooksmith.rb', line 61 def self.configure yield(configuration) end |
.logger ⇒ Logger
Returns the gem's logger instance.
67 68 69 |
# File 'lib/hooksmith.rb', line 67 def self.logger Logger.instance end |
.verifier_configured?(provider) ⇒ Boolean
Checks if a provider has a verifier configured.
88 89 90 91 |
# File 'lib/hooksmith.rb', line 88 def self.verifier_configured?(provider) verifier = configuration.verifier_for(provider) verifier&.enabled? || false end |
.verify!(provider:, request:) ⇒ void
This method returns an undefined value.
Verifies an incoming webhook request for a provider.
77 78 79 80 81 82 |
# File 'lib/hooksmith.rb', line 77 def self.verify!(provider:, request:) verifier = configuration.verifier_for(provider) return unless verifier&.enabled? verifier.verify!(request) end |