Sha256: 2330e10ee569c49e99c401aced62934452ae469fc837439929513ff4af5893ef

Contents?: true

Size: 867 Bytes

Versions: 6

Compression:

Stored size: 867 Bytes

Contents

module Savon
  module Hooks

    # = Savon::Hooks::Hook
    #
    # A hook used somewhere in the system.
    class Hook

      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

      ]

      # Expects an +id+, the name of the +hook+ to use and a +block+ to be called.
      def initialize(id, hook, &block)
        self.id = id
        self.hook = hook
        self.block = block
      end

      attr_accessor :id, :hook, :block

      # Calls the +block+ with the given +args+.
      def call(*args)
        block.call(*args)
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
savon-0.9.14 lib/savon/hooks/hook.rb
savon-0.9.11 lib/savon/hooks/hook.rb
savon-0.9.10 lib/savon/hooks/hook.rb
savon-0.9.9 lib/savon/hooks/hook.rb
savon-0.9.8 lib/savon/hooks/hook.rb
regenersis-savon-1.0.0 lib/savon/hooks/hook.rb