Class: Vault::Web
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Vault::Web
- Defined in:
- lib/vault-tools/web.rb
Overview
Base class for HTTP API services.
Class Method Summary collapse
-
.route(verb, action) ⇒ Object
Store the action for logging purposes.
Instance Method Summary collapse
-
#/ ⇒ Object
Determine if the service is running and responding to requests.
-
#/health ⇒ Object
Determine if the service is running and responding to requests.
-
#boom ⇒ Object
Trigger an internal server error (to test monitoring and paging tools).
Class Method Details
.route(verb, action) ⇒ Object
Store the action for logging purposes.
7 8 9 10 |
# File 'lib/vault-tools/web.rb', line 7 def self.route(verb, action, *) condition { @action = action } super end |
Instance Method Details
#/ ⇒ Object
Determine if the service is running and responding to requests.
67 68 69 |
# File 'lib/vault-tools/web.rb', line 67 head '/' do status(200) end |
#/health ⇒ Object
Determine if the service is running and responding to requests.
78 79 80 |
# File 'lib/vault-tools/web.rb', line 78 get '/health' do [200, 'OK'] end |
#boom ⇒ Object
Trigger an internal server error (to test monitoring and paging tools).
89 90 91 |
# File 'lib/vault-tools/web.rb', line 89 get '/boom' do raise "An expected error occurred." end |