module Finicity::Logger

Public Instance Methods

log_request() click to toggle source
# File lib/finicity/logger.rb, line 3
def log_request
  ::Finicity.logger.debug do
    log = "REQUEST: #{self.class.name}"
    log << "\n  URL: #{url}" if self.respond_to?(:url)
    log << "\n  QUERY: #{query}" if self.respond_to?(:query)
    log << "\n  BODY: #{mask_body(body)}" if self.respond_to?(:body)
    log
  end
end
mask_body(body) click to toggle source
# File lib/finicity/logger.rb, line 13
def mask_body(body)
  body = body.gsub(/<value>.*<\/value>/, "<value>[FILTERED]</value>")
  body = body.gsub(/<answer>.*<\/answer>/, "<answer>[FILTERED]</answer>")
  body
end