Class: Dadata::SensitiveDataMiddleware Private

Inherits:
Faraday::Middleware
  • Object
show all
Includes:
SensitiveData
Defined in:
lib/dadata/client/base.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Faraday middleware that handles logging of requests and responses while ensuring sensitive data is properly sanitized. This middleware is automatically added to all DaData API clients.

Constant Summary

Constants included from SensitiveData

Dadata::SensitiveData::SENSITIVE_HEADERS

Instance Method Summary collapse

Methods included from SensitiveData

#sanitize_headers, #sanitize_message

Instance Method Details

#call(env) ⇒ Faraday::Response

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Processes the request, logs it securely, and handles any errors

Parameters:

  • env (Hash)

    The request environment

Returns:

  • (Faraday::Response)

    The response from the next middleware



21
22
23
24
25
26
27
28
29
# File 'lib/dadata/client/base.rb', line 21

def call(env)
  log_request(env)
  @app.call(env).on_complete do |response_env|
    log_response(response_env)
  end
rescue Faraday::Error => e
  log_error(e)
  raise
end