Sha256: 996e7aabbb7c575bf9541e04bc2d754f746efd29e985334bb85d746a71ebdf42

Contents?: true

Size: 1.23 KB

Versions: 22

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true
require 'qa_server/engine'
require 'qa_server/version'
require 'user_agent'
require 'deprecation'

module QaServer
  extend ActiveSupport::Autoload
  extend Deprecation

  self.deprecation_horizon = 'LD4P/QaServer v6.0.0'

  autoload :Configuration

  # @api public
  #
  # Exposes the Questioning Authority configuration
  #
  # @yield [Qa::Configuration] if a block is passed
  # @return [Qa::Configuration]
  # @see Qa::Configuration for configuration options
  def self.config(&block)
    @config ||= QaServer::Configuration.new

    yield @config if block

    @config
  end

  def self.log_agent_info(request)
    return if !Qa.config.respond_to?(:suppress_ip_data_from_log) || Qa.config.suppress_ip_data_from_log
    user_agent = request.respond_to?(:user_agent) && !request.user_agent.nil? ? ::UserAgent.parse(request.user_agent) : nil
    return Rails.logger.info("{browser: UNKNOWN, browser_version: UNKNOWN, platform: UNKNOWN, os: UNKNOWN}") if user_agent.nil?
    browser = user_agent.browser
    browser_version = user_agent.version
    platform = user_agent.platform
    os = user_agent.os
    Rails.logger.info("{browser: #{browser}, browser_version: #{browser_version}, platform: #{platform}, os: #{os}}")
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
qa_server-8.0.1 lib/qa_server.rb
qa_server-7.9.2 lib/qa_server.rb
qa_server-7.9.1 lib/qa_server.rb
qa_server-7.9.0 lib/qa_server.rb
qa_server-7.8.0 lib/qa_server.rb
qa_server-7.7.1 lib/qa_server.rb
qa_server-7.7.0 lib/qa_server.rb
qa_server-7.6.0 lib/qa_server.rb
qa_server-7.5.1 lib/qa_server.rb
qa_server-7.5.0 lib/qa_server.rb
qa_server-7.4.0 lib/qa_server.rb
qa_server-7.3.0 lib/qa_server.rb
qa_server-7.2.1 lib/qa_server.rb
qa_server-7.2.0 lib/qa_server.rb
qa_server-7.1.3 lib/qa_server.rb
qa_server-7.1.2 lib/qa_server.rb
qa_server-7.1.1 lib/qa_server.rb
qa_server-7.1.0 lib/qa_server.rb
qa_server-7.0.0 lib/qa_server.rb
qa_server-6.2.0 lib/qa_server.rb