Class: RhoDevelopment::NewTask

Inherits:
WEBrick::HTTPServlet::AbstractServlet
  • Object
show all
Defined in:
lib/build/development/web_server.rb

Instance Method Summary collapse

Constructor Details

#initialize(server, instance) ⇒ NewTask

Returns a new instance of NewTask.



152
153
154
155
# File 'lib/build/development/web_server.rb', line 152

def initialize server, instance
  super server
  @instance = instance
end

Instance Method Details

#do_POST(request, response) ⇒ Object



157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/build/development/web_server.rb', line 157

def do_POST request, response
  task_name = request.query['taskName']
  task = LiveUpdateTask.descendants.detect { |each|
    each.taskName == task_name }
  if task != nil
    @instance.add_task(task.fromHash(request.query))
    response.status = 200
    response.body = "Task #{task_name} was added"
  else
    puts request.query.to_s.warning
    raise "Task #{task_name} not found".warning
  end
end