Sha256: 9fe214314e762ac0c5f83c0b057263044b5885b9c16b379e45d8a48e184e65f4

Contents?: true

Size: 954 Bytes

Versions: 1

Compression:

Stored size: 954 Bytes

Contents

module Aitch
  class Configuration
    # Set proxy.
    attr_accessor :proxy

    # Set request timeout.
    attr_accessor :timeout

    # Set default headers.
    attr_accessor :default_headers

    # Set follow redirect.
    attr_accessor :follow_redirect

    # Set redirection limit.
    attr_accessor :redirect_limit

    # Set the user agent.
    attr_accessor :user_agent

    # Set the logger.
    attr_accessor :logger

    # Set the JSON parser.
    attr_accessor :json_parser

    # Set the XML parser.
    attr_accessor :xml_parser

    def initialize
      @timeout = 10
      @redirect_limit = 5
      @follow_redirect = true
      @user_agent = "Aitch/#{Aitch::VERSION} (http://rubygems.org/gems/aitch)"
      @default_headers = {}
      @json_parser = JSON
      @xml_parser = XMLParser
    end
  end

  def self.configure(&block)
    yield configuration
  end

  def self.configuration
    @configuration ||= Configuration.new
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aitch-0.1.0 lib/aitch/configuration.rb