Class: Webcmd::App
- Inherits:
-
Object
- Object
- Webcmd::App
- Defined in:
- lib/webcmd/app.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(options = {}) ⇒ App
constructor
A new instance of App.
Constructor Details
#initialize(options = {}) ⇒ App
Returns a new instance of App.
5 6 7 8 |
# File 'lib/webcmd/app.rb', line 5 def initialize(={}) @command = [:command] @token = [:token] end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/webcmd/app.rb', line 10 def call(env) if token_valid?(env) [200, {'Content-Type' => 'text/plain'}, CommandRunner.new(@command)] else [403, {'Content-Type' => 'text/plain'}, ['Token invalid']] end end |