summaryrefslogtreecommitdiff
path: root/lib/opentox.rb
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.ch>2015-07-16 19:07:29 +0200
committerChristoph Helma <helma@in-silico.ch>2015-07-16 19:07:29 +0200
commita8e52efbfd977c7ecfc98df10960686a05ed8afd (patch)
treed6690c3cd161be589b4fd84a184c1b9740707205 /lib/opentox.rb
parentfceabfcc4e281c582ec5cc09ba84eb49e20a13f0 (diff)
task tests passed
Diffstat (limited to 'lib/opentox.rb')
-rw-r--r--lib/opentox.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/opentox.rb b/lib/opentox.rb
index b2e9c1b..9be6078 100644
--- a/lib/opentox.rb
+++ b/lib/opentox.rb
@@ -19,7 +19,7 @@ module OpenTox
end
def created_at
- # TODO from BSON::ObjectId
+ @data["_id"].generation_time
end
# Object metadata (lazy loading)
@@ -66,6 +66,11 @@ module OpenTox
@data["_id"] = $mongo[collection].insert_one(@data).inserted_id
end
+ # partial update
+ def update metadata
+ $mongo[collection].find(:_id => @data["_id"]).find_one_and_replace('$set' => metadata)
+ end
+
# Save object at webservice (replace or create object)
def put
#@data.delete("_id") # to enable updates