Class: Aitch::Configuration

Inherits:
Object show all
Defined in:
lib/aitch/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



29
30
31
32
33
34
35
36
# File 'lib/aitch/configuration.rb', line 29

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

Instance Attribute Details

#base_urlObject

Set the base url.



27
28
29
# File 'lib/aitch/configuration.rb', line 27

def base_url
  @base_url
end

#default_headersObject

Set default headers.



12
13
14
# File 'lib/aitch/configuration.rb', line 12

def default_headers
  @default_headers
end

#follow_redirectObject

Set follow redirect.



15
16
17
# File 'lib/aitch/configuration.rb', line 15

def follow_redirect
  @follow_redirect
end

#loggerObject

Set the logger.



24
25
26
# File 'lib/aitch/configuration.rb', line 24

def logger
  @logger
end

#proxyObject

Set proxy.



6
7
8
# File 'lib/aitch/configuration.rb', line 6

def proxy
  @proxy
end

#redirect_limitObject

Set redirection limit.



18
19
20
# File 'lib/aitch/configuration.rb', line 18

def redirect_limit
  @redirect_limit
end

#timeoutObject

Set request timeout.



9
10
11
# File 'lib/aitch/configuration.rb', line 9

def timeout
  @timeout
end

#user_agentObject

Set the user agent.



21
22
23
# File 'lib/aitch/configuration.rb', line 21

def user_agent
  @user_agent
end

Instance Method Details

#to_hObject



38
39
40
41
42
# File 'lib/aitch/configuration.rb', line 38

def to_h
  instance_variables.each_with_object({}) do |name, buffer|
    buffer[name.to_s.tr("@", "").to_sym] = instance_variable_get(name)
  end
end