Class: AchClient::Logging::SavonObserver

Inherits:
Object
  • Object
show all
Defined in:
lib/ach_client/logging/savon_observer.rb

Overview

Hooks into every savon request. #notify is called before the request is made

Instance Method Summary collapse

Instance Method Details

#notify(operation_name, builder, _globals, _locals) ⇒ NilClass

Hooks into every SOAP request and sends the XML body to be logged.

Parameters:

  • operation_name (Symbol)

    name of SOAP operation being exectuted

  • builder (Savon::Builder)

    Savon wrapper for the request

  • globals (Savon::GlobalOptions)

    Savon's global options

  • locals (Savon::LocalOptions)

    Savon's global options

Returns:

  • (NilClass)

    returns nothing so the request is not mutated



14
15
16
17
18
19
20
21
22
23
# File 'lib/ach_client/logging/savon_observer.rb', line 14

def notify(operation_name, builder, _globals, _locals)
  # Send the xml body to the logger job
  AchClient::Logging::LogProviderJob.perform_async(
    body: builder.to_s,
    name: "request-#{operation_name}-#{DateTime.now}.xml"
  )

  # Must return nil so the request is unaltered
  nil
end