Class: Webhookapp::Tunnel::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/webhookapp/tunnel/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(local_port, hook_id, client_id, username, password) ⇒ Client

Returns a new instance of Client.

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/webhookapp/tunnel/client.rb', line 8

def initialize(local_port, hook_id, client_id, username, password)
  raise ArgumentError, 'Unknown local port' unless local_port
  raise ArgumentError, 'Unknown hook' unless hook_id

  @connections = {}

  @local_port = local_port
  @hook_id = hook_id
  @client_id = client_id
  @username = username
  @password = password
  @details = nil
  @remote_port = nil
  @control = nil
end

Instance Method Details

#startObject



24
25
26
27
28
29
30
31
# File 'lib/webhookapp/tunnel/client.rb', line 24

def start
  request_tunnel_details
  if @details
    start_tunnel
  else
    log "Closing due to lack of details"
  end
end

#stopObject



33
34
35
# File 'lib/webhookapp/tunnel/client.rb', line 33

def stop
  @stopping = true
end