Sha256: e144b4a56ba1982d057db02e120698daa69bab8fc8440e8f0155ebbb3f5c8b96

Contents?: true

Size: 775 Bytes

Versions: 2

Compression:

Stored size: 775 Bytes

Contents

# frozen_string_literal: true

require 'logger'

module ONEAccess
  class Configuration
    DEFAULT_BASE_URL = 'http://ws.oneaccess.io'
    DEFAULT_BASE_V1_1_PATH = '/v1.1'
    DEFAULT_BASE_V3_0_PATH = '/v3.0'

    class << self
      attr_accessor :base_url
      attr_accessor :api_key
      attr_accessor :master_api_key
      attr_writer :logger
      attr_accessor :log_requests

      def base_v1_1_url
        "#{base_url}#{DEFAULT_BASE_V1_1_PATH}"
      end

      def base_v3_0_url
        "#{base_url}#{DEFAULT_BASE_V3_0_PATH}"
      end

      def reset!
        self.base_url = DEFAULT_BASE_URL
        self.api_key = nil
        self.master_api_key = nil
      end

      def logger
        @logger ||= Logger.new(STDOUT)
      end
    end

    reset!
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oneaccess-1.3.1 lib/oneaccess/configuration.rb
oneaccess-1.3.0 lib/oneaccess/configuration.rb