summaryrefslogtreecommitdiff
path: root/lib/opentox.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2012-07-13 12:24:37 +0200
committerChristoph Helma <helma@in-silico.ch>2012-07-13 12:24:37 +0200
commit66dae77b92308bb09781948ad4caf90b770d1ef8 (patch)
tree029f0f32cfd4a94922a58229fde3a531f1705ecf /lib/opentox.rb
parentbf6834445feb6f93f0a20359462dbd1e7e89f4b8 (diff)
wait for tasks in post/put requests
Diffstat (limited to 'lib/opentox.rb')
-rw-r--r--lib/opentox.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/opentox.rb b/lib/opentox.rb
index 9225bb0..019699b 100644
--- a/lib/opentox.rb
+++ b/lib/opentox.rb
@@ -67,20 +67,22 @@ module OpenTox
end
# Post object to webservice
- def post service_uri
- RestClientWrapper.post service_uri, to_ntriples, { :content_type => "text/plain", :subjectid => @subjectid}
+ def post service_uri, wait=true
+ uri = RestClientWrapper.post service_uri, to_ntriples, { :content_type => "text/plain", :subjectid => @subjectid}
+ OpenTox::Task.new(uri).wait if URI.task?(uri) and wait
#rescue # fall back to rdfxml
#RestClientWrapper.post service_uri, to_rdfxml, { :content_type => "application/rdf+xml", :subjectid => @subjectid}
end
# Save object at webservice
- def put
+ def put wait=true
append RDF::DC.modified, DateTime.now
#begin
RestClientWrapper.put @uri.to_s, self.to_ntriples, { :content_type => "text/plain", :subjectid => @subjectid}
#rescue # fall back to rdfxml
#RestClientWrapper.put @uri.to_s, self.to_rdfxml, { :content_type => "application/rdf+xml", :subjectid => @subjectid}
#end
+ OpenTox::Task.new(uri).wait if URI.task?(uri) and wait
end
# Delete object at webservice