Class: Simulacrum::Browserstack::Tunnel

Inherits:
Object
  • Object
show all
Defined in:
lib/simulacrum/browserstack/tunnel.rb

Overview

Class for handling Browserstack tunnel opening/closing/management

Constant Summary collapse

DEFAULT_OPTIONS =
{
  skip_check: true,
  only_automate: false,
  verbose: false,
  force: true
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username, apikey, ports, options = {}) ⇒ Tunnel

Returns a new instance of Tunnel.



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/simulacrum/browserstack/tunnel.rb', line 20

def initialize(username, apikey, ports, options = {})
  @pid = nil
  @open = false
  @username = username
  @apikey = apikey
  @ports = ports
  @options = OpenStruct.new(DEFAULT_OPTIONS.clone.merge!(options))

  create_tunnel
  ensure_open
end

Instance Attribute Details

#openObject (readonly) Also known as: open?

Returns the value of attribute open.



10
11
12
# File 'lib/simulacrum/browserstack/tunnel.rb', line 10

def open
  @open
end

#pidObject (readonly)

Returns the value of attribute pid.



10
11
12
# File 'lib/simulacrum/browserstack/tunnel.rb', line 10

def pid
  @pid
end

#portsObject (readonly)

Returns the value of attribute ports.



10
11
12
# File 'lib/simulacrum/browserstack/tunnel.rb', line 10

def ports
  @ports
end

#selenium_remote_urlObject (readonly)

Returns the value of attribute selenium_remote_url.



10
11
12
# File 'lib/simulacrum/browserstack/tunnel.rb', line 10

def selenium_remote_url
  @selenium_remote_url
end

Instance Method Details

#closeObject



36
37
38
# File 'lib/simulacrum/browserstack/tunnel.rb', line 36

def close
  kill
end