Class: SolidusWebhooks::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/solidus_webhooks/configuration.rb

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
# File 'lib/solidus_webhooks/configuration.rb', line 7

def initialize
  @handlers = {}
end

Instance Method Details

#find_webhook_handler(id) ⇒ Object



20
21
22
# File 'lib/solidus_webhooks/configuration.rb', line 20

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

#register_webhook_handler(id, handler) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/solidus_webhooks/configuration.rb', line 11

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