Class: HttpResource::Configuration
- Inherits:
-
Object
- Object
- HttpResource::Configuration
- Defined in:
- lib/http_resource/configuration.rb
Overview
Holds the settings for building a default client (HttpResource.client). Framework-generic: no app-specific env names. A host sets these explicitly in an initializer, mapping ITS own env vars onto them.
HttpResource.configure do |c|
c.base_url = ENV.fetch("API_URL")
c.auth = HttpResource::Auth.bearer(ENV.fetch("API_TOKEN"))
end
Instance Attribute Summary collapse
-
#auth ⇒ Object
Returns the value of attribute auth.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
15 16 17 18 19 20 |
# File 'lib/http_resource/configuration.rb', line 15 def initialize @base_url = nil @auth = nil @open_timeout = Client::DEFAULT_OPEN_TIMEOUT @read_timeout = Client::DEFAULT_READ_TIMEOUT end |
Instance Attribute Details
#auth ⇒ Object
Returns the value of attribute auth.
13 14 15 |
# File 'lib/http_resource/configuration.rb', line 13 def auth @auth end |
#base_url ⇒ Object
Returns the value of attribute base_url.
13 14 15 |
# File 'lib/http_resource/configuration.rb', line 13 def base_url @base_url end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
13 14 15 |
# File 'lib/http_resource/configuration.rb', line 13 def open_timeout @open_timeout end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
13 14 15 |
# File 'lib/http_resource/configuration.rb', line 13 def read_timeout @read_timeout end |