class TunnelBroker::Messenger
The class for communicating with the API
Public Class Methods
new(opts)
click to toggle source
# File lib/tunnelbroker/messenger.rb, line 10 def initialize(opts) opts_to_inst(opts) end
Public Instance Methods
call_api()
click to toggle source
# File lib/tunnelbroker/messenger.rb, line 14 def call_api TunnelBroker::APIResponse.new(call_endpoint) end
Private Instance Methods
call_endpoint()
click to toggle source
# File lib/tunnelbroker/messenger.rb, line 26 def call_endpoint auth = { username: @username, password: @update_key } query = { hostname: @tunnelid } query.merge!(myip: @ip4addr) unless @ip4addr.nil? self.class.get(@url, basic_auth: auth, query: query) end
opts_to_inst(opts)
click to toggle source
# File lib/tunnelbroker/messenger.rb, line 20 def opts_to_inst(opts) opts.each do |k, v| instance_variable_set(:"@#{k}", v) end end