class XpRubyClient::Configurator

Constants

ASSIGN_URL_PATH
DEFAULT_TIMEOUT

Attributes

application[RW]
assigned[RW]
segments[RW]
timeout[RW]

Public Class Methods

new(&block) click to toggle source
# File lib/xp_ruby_client/configurator.rb, line 10
def initialize(&block)
  @segments = {}
  @assigned = []

  block.call(self)

  @timeout = DEFAULT_TIMEOUT unless timeout
  raise(NotSetError, "'application' must be set") unless @application
end

Public Instance Methods

base_url() click to toggle source
# File lib/xp_ruby_client/configurator.rb, line 20
def base_url
  @base_url ||= URI.join(host, ASSIGN_URL_PATH, @application).to_s
end
to_h() click to toggle source
# File lib/xp_ruby_client/configurator.rb, line 24
def to_h
  {segments: @segments,
   assigned: @assigned}
end

Private Instance Methods

host() click to toggle source
# File lib/xp_ruby_client/configurator.rb, line 31
def host
  ENV.fetch("XP_RUBY_CLIENT_HOST")
end