Sha256: 084cc5daba7cf688037934d1ef3f20347135bc35de712378087865e089aa4ab8

Contents?: true

Size: 481 Bytes

Versions: 1

Compression:

Stored size: 481 Bytes

Contents

require 'solidus_webhooks/errors'

module SolidusWebhooks
  class Configuration
    def initialize
      @handlers = {}
    end

    def register_webhook_handler(id, handler)
      unless handler.respond_to? :call
        raise SolidusWebhooks::InvalidHandler,
          "Please provide a handler that responds to #call, got: #{handler.inspect}"
      end

      @handlers[id.to_sym] = handler
    end

    def find_webhook_handler(id)
      @handlers[id.to_sym]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_webhooks-0.3.0 lib/solidus_webhooks/configuration.rb