Class: Payments::Client::Gateway
- Inherits:
-
Object
- Object
- Payments::Client::Gateway
- Defined in:
- lib/payments/client/gateway.rb
Instance Method Summary collapse
-
#initialize(adapter, config, *adapter_options, connection: nil) ⇒ Gateway
constructor
A new instance of Gateway.
- #with_middleware(keep: true, response: nil) ⇒ Object
Constructor Details
#initialize(adapter, config, *adapter_options, connection: nil) ⇒ Gateway
Returns a new instance of Gateway.
9 10 11 12 13 14 |
# File 'lib/payments/client/gateway.rb', line 9 def initialize(adapter, config, *, connection: nil) @config = config @adapter = adapter @adapter_options = @connection = connection end |
Instance Method Details
#with_middleware(keep: true, response: nil) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/payments/client/gateway.rb', line 28 def with_middleware(keep: true, response: nil) new_connection = connection.dup new_connection.build(keep: keep) do |builder| Array(response).each do |middleware| builder.response middleware end end self.class.new( @adapter, @config, *@adapter_options, connection: new_connection, ) end |