Class: Webcmd::App

Inherits:
Object
  • Object
show all
Defined in:
lib/webcmd/app.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ App

Returns a new instance of App.



5
6
7
8
# File 'lib/webcmd/app.rb', line 5

def initialize(options={})
  @command = options[:command]
  @token   = options[: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