summaryrefslogtreecommitdiff
path: root/lib/utils/shims/task.rb
blob: 7ac8a7d9af79c29b930db4ce233fcfd110d96b26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
=begin
* Name: task.rb
* Description: Task shims
* Author: Andreas Maunz <andreas@maunz.de>
* Date: 10/2012
=end


module OpenTox

  # Shims for the Task class
  class Task

    def self.run(description, creator, subjectid=nil)
       create($task[:uri],subjectid,{ RDF::DC.description => description, RDF::DC.creator => creator},&Proc.new) 
    end

    # Check status of a task
    # @return [String] Status
    def status
      self[RDF::OT.hasStatus]
    end
    
    def code
      RestClientWrapper.head(@uri).code
    end

  end

end


module OpenTox

  class SubTask
    
    def initialize(task, min, max)
      #TODO add subtask code
    end

    def self.create(task, min, max)
      if task
        SubTask.new(task, min, max)
      else
        nil
      end
    end
    
    def waiting_for(task_uri)
      #TODO add subtask code
    end
    
    def progress(pct)
      #TODO add subtask code
    end
    
    def running?()
      #TODO add subtask code
    end
  end
  
end