Class: Consul::Client::Base
- Inherits:
-
Object
- Object
- Consul::Client::Base
- Defined in:
- lib/consul/client/base.rb
Overview
Public API Base.
Instance Method Summary collapse
-
#initialize(options = nil) ⇒ Base
constructor
Public: Constructor with options hash.
-
#is_reachable ⇒ Object
Public: Test if this Consul Client is reachable.
Constructor Details
#initialize(options = nil) ⇒ Base
Public: Constructor with options hash
Optional Parameters:
options[:data_center] - The consul data center. Default: 'dc1'.
options[:api_host] - The api host to request against. Default: '127.0.0.1'.
options[:api_port] - The api port the api host is listening to. Default: '8500'.
options[:version] - The Consul API version to use. Default: 'v1'.
options[:logger] - The default logging mechanism. Default: Logger.new(STDOUT).
Return: This instance
22 23 24 25 26 |
# File 'lib/consul/client/base.rb', line 22 def initialize( = nil) = {} if .nil? raise TypeError, 'Options must be nil or a Hash' unless .is_a?(Hash) @options = .clone end |
Instance Method Details
#is_reachable ⇒ Object
Public: Test if this Consul Client is reachable.
29 30 31 |
# File 'lib/consul/client/base.rb', line 29 def is_reachable _get(base_url, nil, false) == 'Consul Agent' end |