Class: CortexClient::Configuration
- Inherits:
-
Object
- Object
- CortexClient::Configuration
- Defined in:
- lib/cortex_client/configuration.rb
Instance Attribute Summary collapse
-
#agents ⇒ Object
readonly
Returns the value of attribute agents.
-
#connect_timeout ⇒ Object
readonly
Returns the value of attribute connect_timeout.
-
#host ⇒ Object
Returns the value of attribute host.
-
#metrics_push_api_path ⇒ Object
Returns the value of attribute metrics_push_api_path.
-
#read_timeout ⇒ Object
readonly
Returns the value of attribute read_timeout.
-
#token ⇒ Object
Returns the value of attribute token.
-
#write_timeout ⇒ Object
readonly
Returns the value of attribute write_timeout.
Instance Method Summary collapse
- #agent ⇒ Object
- #agent=(agent_attributes) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #valid? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 9 10 11 12 13 14 |
# File 'lib/cortex_client/configuration.rb', line 6 def initialize @host = '' @token = '' @metrics_push_api_path = '' @read_timeout = 75 @connect_timeout = 10 @write_timeout = 75 @agents = [Http::Agent.new(name: CortexClient.name, version: CortexClient::VERSION)] end |
Instance Attribute Details
#agents ⇒ Object (readonly)
Returns the value of attribute agents.
4 5 6 |
# File 'lib/cortex_client/configuration.rb', line 4 def agents @agents end |
#connect_timeout ⇒ Object (readonly)
Returns the value of attribute connect_timeout.
4 5 6 |
# File 'lib/cortex_client/configuration.rb', line 4 def connect_timeout @connect_timeout end |
#host ⇒ Object
Returns the value of attribute host.
3 4 5 |
# File 'lib/cortex_client/configuration.rb', line 3 def host @host end |
#metrics_push_api_path ⇒ Object
Returns the value of attribute metrics_push_api_path.
3 4 5 |
# File 'lib/cortex_client/configuration.rb', line 3 def metrics_push_api_path @metrics_push_api_path end |
#read_timeout ⇒ Object (readonly)
Returns the value of attribute read_timeout.
4 5 6 |
# File 'lib/cortex_client/configuration.rb', line 4 def read_timeout @read_timeout end |
#token ⇒ Object
Returns the value of attribute token.
3 4 5 |
# File 'lib/cortex_client/configuration.rb', line 3 def token @token end |
#write_timeout ⇒ Object (readonly)
Returns the value of attribute write_timeout.
4 5 6 |
# File 'lib/cortex_client/configuration.rb', line 4 def write_timeout @write_timeout end |
Instance Method Details
#agent ⇒ Object
28 29 30 |
# File 'lib/cortex_client/configuration.rb', line 28 def agent Http::Agent.list_to_s(@agents) end |
#agent=(agent_attributes) ⇒ Object
24 25 26 |
# File 'lib/cortex_client/configuration.rb', line 24 def agent=(agent_attributes) @agents.push(Http::Agent.new(agent_attributes)) end |
#valid? ⇒ Boolean
16 17 18 19 20 21 22 |
# File 'lib/cortex_client/configuration.rb', line 16 def valid? !@token.empty? && !@host.empty? && !@host.end_with?('/') && !@metrics_push_api_path.empty? && !@metrics_push_api_path.start_with?('/') end |