Sha256: d15ab2337b9468b383a0a71651897547f3c33a3d2bbe18ea30a2cd645dd720e2

Contents?: true

Size: 1.74 KB

Versions: 7

Compression:

Stored size: 1.74 KB

Contents

# Copyright (c) 2022 Contrast Security, Inc. See https://www.contrastsecurity.com/enduser-terms-0317a for more details.
# frozen_string_literal: true

require 'contrast/config/api_proxy_configuration'
require 'contrast/config/certification_configuration'
require 'contrast/config/request_audit_configuration'

module Contrast
  module Config
    # Api keys configuration
    class ApiConfiguration
      include Contrast::Config::BaseConfiguration

      # @return [String]
      attr_accessor :api_key
      # @return [String]
      attr_accessor :user_name
      # @return [String]
      attr_accessor :service_key
      attr_writer :url, :proxy, :request_audit, :certificate

      DEFAULT_URL = 'https://app.contrastsecurity.com/Contrast'

      def initialize hsh = {}
        return unless hsh

        @api_key = hsh[:api_key]
        @url = hsh[:url]
        @user_name = hsh[:user_name]
        @service_key = hsh[:service_key]
        @proxy = Contrast::Config::ApiProxyConfiguration.new(hsh[:proxy])
        @request_audit = Contrast::Config::RequestAuditConfiguration.new(hsh[:request_audit])
        @certificate = Contrast::Config::CertificationConfiguration.new(hsh[:certificate])
      end

      def url
        @url.nil? ? DEFAULT_URL : @url
      end

      # @return [Contrast::Config::ApiProxyConfiguration]
      def proxy
        @proxy ||= Contrast::Config::ApiProxyConfiguration.new
      end

      # @return [Contrast::Config::RequestAuditConfiguration]
      def request_audit
        @request_audit ||= Contrast::Config::RequestAuditConfiguration.new
      end

      # @return [Contrast::Config::CertificationConfiguration]
      def certificate
        @certificate ||= Contrast::Config::CertificationConfiguration.new
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
contrast-agent-6.5.0 lib/contrast/config/api_configuration.rb
contrast-agent-6.4.0 lib/contrast/config/api_configuration.rb
contrast-agent-6.3.0 lib/contrast/config/api_configuration.rb
contrast-agent-6.2.0 lib/contrast/config/api_configuration.rb
contrast-agent-6.1.2 lib/contrast/config/api_configuration.rb
contrast-agent-6.1.1 lib/contrast/config/api_configuration.rb
contrast-agent-6.1.0 lib/contrast/config/api_configuration.rb