do not include ApiClient* in discovery document. refs #1405 refs #1406
[arvados.git] / app / controllers / orvos / v1 / collections_controller.rb
index 33a59a06ca0c962b7bd4f8603cde8330cb801d5f..a1afd1e7155f748e6282771d928d92321ccb1e56 100644 (file)
@@ -1,2 +1,21 @@
 class Orvos::V1::CollectionsController < ApplicationController
+  def create
+    # It's not an error for a client to re-register a manifest that we
+    # already know about.
+    @object = model_class.new resource_attrs
+    begin
+      @object.save!
+    rescue ActiveRecord::RecordNotUnique
+      logger.debug resource_attrs.inspect
+      if resource_attrs['manifest_text'] and resource_attrs['uuid']
+        @existing_object = model_class.
+          where('uuid=? and manifest_text=?',
+                resource_attrs['uuid'],
+                resource_attrs['manifest_text']).
+          first
+        @object = @existing_object || @object
+      end
+    end
+    show
+  end
 end