Class: VWO::Services::HooksManager

Inherits:
Object
  • Object
show all
Defined in:
lib/vwo/services/hooks_manager.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ HooksManager

Hooks Manager is responsible for triggering callbacks useful to the end-user based on certain lifecycle events. Possible use with integrations when the user intends to send an event when a visitor is part of the experiment.



20
21
22
23
# File 'lib/vwo/services/hooks_manager.rb', line 20

def initialize(config)
  @logger = VWO::Logger.get_instance
  @callback = config[:integrations][:callback] if config.key?(:integrations) && config[:integrations].key?(:callback) && config[:integrations][:callback].is_a?(Method)
end

Instance Method Details

#execute(properties) ⇒ Object

Executes the callback @param properties Properties from the callback



27
28
29
# File 'lib/vwo/services/hooks_manager.rb', line 27

def execute(properties)
  @callback&.call(properties)
end