Sha256: 75284962a0b8a0461089326b157a56a334a0748a8b701c9de1ba3a140ba78744

Contents?: true

Size: 590 Bytes

Versions: 4

Compression:

Stored size: 590 Bytes

Contents

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

    def register_webhook_handler(id, handler)
      unless handler.respond_to? :call
        raise Spree::Webhook::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

  def self.config
    @config
  end

  def self.reset_config!
    @config = Configuration.new
  end

  reset_config! # initialize the extension
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_webhooks-0.2.0 lib/solidus_webhooks/configuration.rb
solidus_webhooks-0.1.0 lib/solidus_webhooks/configuration.rb
solidus_webhooks-0.1.0.beta.1 lib/solidus_webhooks/configuration.rb
solidus_webhooks-0.0.1.v0.1.0.beta.1.1 lib/solidus_webhooks/configuration.rb