diff options
-rw-r--r-- | lib/opentox.rb | 9 |
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 |