Sha256: 3a9427fc3babb9652af3b44107610c3fbccab704cf276a4e51bec76d372bdc78

Contents?: true

Size: 859 Bytes

Versions: 37

Compression:

Stored size: 859 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_key, :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", :xml).to_s
      end

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

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
sportradar-api-0.1.38 lib/sportradar/api/config.rb
sportradar-api-0.1.37 lib/sportradar/api/config.rb
sportradar-api-0.1.36 lib/sportradar/api/config.rb
sportradar-api-0.1.35 lib/sportradar/api/config.rb
sportradar-api-0.1.34 lib/sportradar/api/config.rb
sportradar-api-0.1.33 lib/sportradar/api/config.rb
sportradar-api-0.1.32 lib/sportradar/api/config.rb
sportradar-api-0.1.31 lib/sportradar/api/config.rb
sportradar-api-0.1.30 lib/sportradar/api/config.rb
sportradar-api-0.1.29 lib/sportradar/api/config.rb
sportradar-api-0.1.28 lib/sportradar/api/config.rb
sportradar-api-0.1.27 lib/sportradar/api/config.rb
sportradar-api-0.1.26 lib/sportradar/api/config.rb
sportradar-api-0.1.25 lib/sportradar/api/config.rb
sportradar-api-0.1.24 lib/sportradar/api/config.rb
sportradar-api-0.1.23 lib/sportradar/api/config.rb
sportradar-api-0.1.22 lib/sportradar/api/config.rb
sportradar-api-0.1.21 lib/sportradar/api/config.rb
sportradar-api-0.1.19 lib/sportradar/api/config.rb
sportradar-api-0.1.18 lib/sportradar/api/config.rb