summaryrefslogtreecommitdiff
path: root/lib/opentox.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2012-04-25 15:24:04 +0200
committerChristoph Helma <helma@in-silico.ch>2012-04-25 15:24:04 +0200
commit4bc73a2190254239742e33830747ff31fb5e431b (patch)
treef4c1ca16bb17fac47c9ba772cda544f10928d910 /lib/opentox.rb
parent1510d98692c50532b9c0f1919d96228825f40054 (diff)
new post/put policy
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 f71eaa2..9fac2eb 100644
--- a/lib/opentox.rb
+++ b/lib/opentox.rb
@@ -45,10 +45,12 @@ module OpenTox
FourStore.list request.env['HTTP_ACCEPT']
end
- # Create a new URI, does not accept a payload (use put for this purpose)
+ # Create a new resource
+ # TODO: handle multipart uploads
post '/?' do
+ rdf = request.body.read
uri = uri(SecureRandom.uuid)
- FourStore.put uri, request.body.read, request.content_type
+ FourStore.put(uri, rdf, request.content_type) unless rdf == ''
response['Content-Type'] = "text/uri-list"
uri
end
@@ -58,7 +60,7 @@ module OpenTox
FourStore.get(uri("/#{params[:id]}"), request.env['HTTP_ACCEPT'])
end
- # Modify (add rdf) a resource
+ # Modify (i.e. add rdf statments to) a resource
post '/:id/?' do
FourStore.post uri("/#{params[:id]}"), request.body.read, request.content_type
end