class Payments::Client::Operation

Public Class Methods

new(gateway) click to toggle source
# File lib/payments/client/operations/http.rb, line 4
def initialize(gateway)
  @gateway = gateway
end

Public Instance Methods

call(other_options = {}) click to toggle source
# File lib/payments/client/operations/http.rb, line 8
def call(other_options = {})
  my_options = options.merge(other_options)
  @gateway.public_send(
    method,
    actual_path(my_options),
    my_options,
  )
end

Protected Instance Methods

with_middleware(*args) { || ... } click to toggle source
# File lib/payments/client/operations/http.rb, line 19
def with_middleware(*args)
  previous_gateway = @gateway
  @gateway = @gateway.with_middleware(*args)
  yield
ensure
  @gateway = previous_gateway
end

Private Instance Methods

actual_path(options) click to toggle source
# File lib/payments/client/operations/http.rb, line 33
def actual_path(options)
  path.gsub(/{([^}]+)}/) do |_key|
    value = options.fetch($1.to_sym)
    options.delete($1.to_sym)
    value
  end
end
options() click to toggle source
# File lib/payments/client/operations/http.rb, line 29
def options
  {}
end