class TunnelBroker::Client

TunnelBroker client for communication with the API

Public Instance Methods

config() click to toggle source
# File lib/tunnelbroker/client.rb, line 20
def config
  @config ||= TunnelBroker::Configuration.new
end
configure() { |config| ... } click to toggle source
# File lib/tunnelbroker/client.rb, line 10
def configure
  yield(config) if Kernel.block_given?
end
submit_update() click to toggle source
# File lib/tunnelbroker/client.rb, line 14
def submit_update
  c = build_messenger_config
  tb = TunnelBroker::Messenger.new(c)
  tb.call_api
end

Private Instance Methods

build_messenger_config() click to toggle source
# File lib/tunnelbroker/client.rb, line 26
def build_messenger_config
  conf = {}
  TunnelBroker::Configuration::FIELDS.each do |k|
    conf.merge!(config_hash_item(k))
  end
  conf
end
config_hash_item(key) click to toggle source
# File lib/tunnelbroker/client.rb, line 34
def config_hash_item(key)
  c = config.send(key)
  if c.nil? && key == :url
    { key => ENDPOINT }
  elsif c.nil?
    {}
  else
    { key => c }
  end
end