Class: Sinatra::Base

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

Instance Method Summary collapse

Instance Method Details

#return_task(task) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/overwrite.rb', line 41

def return_task( task )
  code = task.running? ? 202 : 200
  case request.env['HTTP_ACCEPT']
  when /rdf/
    response['Content-Type'] = "application/rdf+xml"
    halt code,task.to_rdfxml
  when /yaml/
    response['Content-Type'] = "application/x-yaml"
    halt code,task.to_yaml # PENDING differs from task-webservice
  when /html/
    response['Content-Type'] = "text/html"
    halt code,OpenTox.text_to_html(task.to_yaml, @subjectid)
  else # default /uri-list/
    response['Content-Type'] = "text/uri-list"
    halt code,task.uri+"\n"
  end
end