Class: Savon::Hooks::Hook

Inherits:
Object
  • Object
show all
Defined in:
lib/savon/hooks/hook.rb

Overview

Savon::Hooks::Hook

A hook used somewhere in the system.

Constant Summary collapse

HOOKS =
[

  # Replaces the POST request executed to call a service.
  # See: Savon::SOAP::Request#response
  #
  # Receives the <tt>Savon::SOAP::Request</tt> and is expected to return an <tt>HTTPI::Response</tt>.
  # It can change the request and return something falsy to still execute the POST request.
  :soap_request

]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, hook, &block) ⇒ Hook

Expects an id, the name of the hook to use and a block to be called.



21
22
23
24
25
# File 'lib/savon/hooks/hook.rb', line 21

def initialize(id, hook, &block)
  self.id = id
  self.hook = hook
  self.block = block
end

Instance Attribute Details

#blockObject

Returns the value of attribute block.



27
28
29
# File 'lib/savon/hooks/hook.rb', line 27

def block
  @block
end

#hookObject

Returns the value of attribute hook.



27
28
29
# File 'lib/savon/hooks/hook.rb', line 27

def hook
  @hook
end

#idObject

Returns the value of attribute id.



27
28
29
# File 'lib/savon/hooks/hook.rb', line 27

def id
  @id
end

Instance Method Details

#call(*args) ⇒ Object

Calls the block with the given args.



30
31
32
# File 'lib/savon/hooks/hook.rb', line 30

def call(*args)
  block.call(*args)
end