Class: Influxdb::Api::Configuration::Host

Inherits:
Object
  • Object
show all
Defined in:
lib/influxdb/api/configuration.rb

Constant Summary collapse

DEFAULT =
['http://localhost:8086'].freeze
DEFAULT_PORT =
8086
DEFAULT_PROTOCOL =
'http'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ Host

Returns a new instance of Host.



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

def initialize(source)
  @source = to_hash(source)
end

Instance Method Details

#buildObject



19
20
21
22
23
24
25
# File 'lib/influxdb/api/configuration.rb', line 19

def build
  result = "#{protocol}://"
  result << "#{user}:#{password}@" if user
  result << "#{host}:#{port}"
  result << path if path
  result
end