Class: HooksService

Inherits:
Object
  • Object
show all
Defined in:
lib/wingify/services/hooks_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ HooksService

Returns a new instance of HooksService.



21
22
23
24
25
# File 'lib/wingify/services/hooks_service.rb', line 21

def initialize(options)
  @callback = options.dig(:integrations, :callback)
  @is_callback_function = is_function?(@callback)
  @decision = {}
end

Instance Attribute Details

#decisionObject (readonly)

Returns the value of attribute decision.



19
20
21
# File 'lib/wingify/services/hooks_service.rb', line 19

def decision
  @decision
end

Instance Method Details

#execute(properties) ⇒ Object

Executes the callback

Parameters:

  • properties (Hash)

    Properties from the callback



29
30
31
# File 'lib/wingify/services/hooks_service.rb', line 29

def execute(properties)
  @callback.call(properties) if @is_callback_function
end

#getHash

Retrieves the decision object

Returns:

  • (Hash)

    The decision object



41
42
43
# File 'lib/wingify/services/hooks_service.rb', line 41

def get
  @decision
end

#set(properties) ⇒ Object

Sets properties to the decision object

Parameters:

  • properties (Hash)

    Properties to set



35
36
37
# File 'lib/wingify/services/hooks_service.rb', line 35

def set(properties)
  @decision = properties if @is_callback_function
end