Class: CnpOnline::DefaultCnpListener

Inherits:
Object
  • Object
show all
Defined in:
lib/CnpListeners.rb

Overview

This listener will run the provided closure over every response hash This is the base class for all listeners applied to transaction responses

Instance Method Summary collapse

Constructor Details

#initialize(&action) ⇒ DefaultCnpListener

Returns a new instance of DefaultCnpListener.



31
32
33
# File 'lib/CnpListeners.rb', line 31

def initialize(&action)
  @action = action
end

Instance Method Details

#apply(duck) ⇒ Object



35
36
37
38
# File 'lib/CnpListeners.rb', line 35

def apply(duck)
  # apply the proc uniformly across all response types
  @action.call(duck)
end