Sha256: cdc1673774e6a58417ddd237c59ad5fa50e63b50383b8bf12916c12af40c5fbb

Contents?: true

Size: 801 Bytes

Versions: 3

Compression:

Stored size: 801 Bytes

Contents

module Sportradar
  module Api
    class << self
      attr_accessor :config
    end

    def self.config
      @config ||= Config.new
    end

    # Set options via block
    def self.configure
      yield(config) if block_given?
    end

    class Config
      attr_accessor :api_timeout, :use_ssl, :format

      def initialize
        @api_key = ENV['API_KEY']
        @api_timeout = ENV.fetch('SPORTRADAR_API_TIMEOUT', 15 )
        @use_ssl = ENV.fetch('SPORTRADAR_API_USE_SSL', true)
        @format = ENV.fetch("SPORTRADAR_API_FORMAT", :json).to_s
      end

      def reset
        @api_timeout = ENV.fetch('SPORTRADAR_API_TIMEOUT', 15 )
        @use_ssl = ENV.fetch('SPORTRADAR_API_USE_SSL', true)
        @format = ENV.fetch("SPORTRADAR_API_FORMAT", :json).to_s
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sportradar-api-0.11.4 lib/sportradar/api/config.rb
sportradar-api-0.11.3 lib/sportradar/api/config.rb
sportradar-api-0.11.1 lib/sportradar/api/config.rb