Class: Aitch::Configuration
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Set the base url.
-
#default_headers ⇒ Object
Set default headers.
-
#follow_redirect ⇒ Object
Set follow redirect.
-
#logger ⇒ Object
Set the logger.
-
#proxy ⇒ Object
Set proxy.
-
#redirect_limit ⇒ Object
Set redirection limit.
-
#timeout ⇒ Object
Set request timeout.
-
#user_agent ⇒ Object
Set the user agent.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ Configuration
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_url ⇒ Object
Set the base url.
27 28 29 |
# File 'lib/aitch/configuration.rb', line 27 def base_url @base_url end |
#default_headers ⇒ Object
Set default headers.
12 13 14 |
# File 'lib/aitch/configuration.rb', line 12 def default_headers @default_headers end |
#follow_redirect ⇒ Object
Set follow redirect.
15 16 17 |
# File 'lib/aitch/configuration.rb', line 15 def follow_redirect @follow_redirect end |
#logger ⇒ Object
Set the logger.
24 25 26 |
# File 'lib/aitch/configuration.rb', line 24 def logger @logger end |
#redirect_limit ⇒ Object
Set redirection limit.
18 19 20 |
# File 'lib/aitch/configuration.rb', line 18 def redirect_limit @redirect_limit end |
#timeout ⇒ Object
Set request timeout.
9 10 11 |
# File 'lib/aitch/configuration.rb', line 9 def timeout @timeout end |
#user_agent ⇒ Object
Set the user agent.
21 22 23 |
# File 'lib/aitch/configuration.rb', line 21 def user_agent @user_agent end |
Instance Method Details
#to_h ⇒ Object
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 |