Class: Mogotest::Tunnel
- Inherits:
-
Object
- Object
- Mogotest::Tunnel
- Defined in:
- lib/mogotest/tunnel.rb
Instance Attribute Summary collapse
-
#api_host ⇒ Object
Returns the value of attribute api_host.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#test_host ⇒ Object
Returns the value of attribute test_host.
-
#tunnel_url ⇒ Object
Returns the value of attribute tunnel_url.
Instance Method Summary collapse
-
#initialize(api_host, api_key, test_host, tunnel_url) ⇒ Tunnel
constructor
A new instance of Tunnel.
- #notify_mogotest_of_tunnel ⇒ Object
- #teardown_tunnel_in_mogotest ⇒ Object
Constructor Details
#initialize(api_host, api_key, test_host, tunnel_url) ⇒ Tunnel
Returns a new instance of Tunnel.
10 11 12 13 14 15 |
# File 'lib/mogotest/tunnel.rb', line 10 def initialize(api_host, api_key, test_host, tunnel_url) @api_host = api_host @api_key = api_key @test_host = test_host @tunnel_url = tunnel_url end |
Instance Attribute Details
#api_host ⇒ Object
Returns the value of attribute api_host.
8 9 10 |
# File 'lib/mogotest/tunnel.rb', line 8 def api_host @api_host end |
#api_key ⇒ Object
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/mogotest/tunnel.rb', line 8 def api_key @api_key end |
#test_host ⇒ Object
Returns the value of attribute test_host.
8 9 10 |
# File 'lib/mogotest/tunnel.rb', line 8 def test_host @test_host end |
#tunnel_url ⇒ Object
Returns the value of attribute tunnel_url.
8 9 10 |
# File 'lib/mogotest/tunnel.rb', line 8 def tunnel_url @tunnel_url end |
Instance Method Details
#notify_mogotest_of_tunnel ⇒ Object
17 18 19 20 21 22 |
# File 'lib/mogotest/tunnel.rb', line 17 def notify_mogotest_of_tunnel RestClient.post "https://#{api_host}/api/v1/ssh_tunnels", { :user_credentials => api_key, :hostname => test_host, :tunnel_url => tunnel_url } rescue puts " [Error] Unable to register tunnel location with Mogotest API. Perhaps your credentials are bad." exit end |
#teardown_tunnel_in_mogotest ⇒ Object
24 25 26 27 28 29 |
# File 'lib/mogotest/tunnel.rb', line 24 def teardown_tunnel_in_mogotest RestClient.post "https://#{api_host}/api/v1/ssh_tunnels/destroy", { :user_credentials => api_key, :hostname => test_host } rescue puts " [Error] Unable to delete tunnel location from Mogotest API. Perhaps your credentials are bad." exit end |