summaryrefslogtreecommitdiff
path: root/lib/opentox.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2012-07-13 12:30:41 +0200
committerChristoph Helma <helma@in-silico.ch>2012-07-13 12:30:41 +0200
commita214c802868e05a5ea90a03c894cf7ef0206da28 (patch)
treea7d52a75495c93a75451df1eb170a489d2b1feb6 /lib/opentox.rb
parent66dae77b92308bb09781948ad4caf90b770d1ef8 (diff)
wait for tasks also in get requests
Diffstat (limited to 'lib/opentox.rb')
-rw-r--r--lib/opentox.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/opentox.rb b/lib/opentox.rb
index 019699b..2e0f05a 100644
--- a/lib/opentox.rb
+++ b/lib/opentox.rb
@@ -60,8 +60,13 @@ module OpenTox
end
# Get object from webservice
- def get
- parse_ntriples RestClientWrapper.get(@uri,{},{:accept => "text/plain", :subjectid => @subjectid})
+ def get wait=true
+ response = RestClientWrapper.get(@uri,{},{:accept => "text/plain", :subjectid => @subjectid})
+ if URI.task?(response) and wait
+ t = OpenTox::Task.new(uri).wait
+ response = RestClientWrapper.get(t.resultURI,{},{:accept => "text/plain", :subjectid => @subjectid})
+ end
+ parse_ntriples response
#rescue # fall back to rdfxml
#parse_rdfxml RestClientWrapper.get(@uri,{},{:accept => "application/rdf+xml", :subjectid => @subjectid})
end