lib/fiona7/routers/rest_api.rb in infopark_fiona7-1.1.0.0.10 vs lib/fiona7/routers/rest_api.rb in infopark_fiona7-1.2.0.0.0
- old
+ new
@@ -27,11 +27,11 @@
if !resource_path.start_with?('/')
resource_path = '/' + resource_path
end
- $stdout.puts "DEBUG GET: #{resource_path}"
+ #Rails.logger.debug "F7 REST GET: #{resource_path}"
case resource_path
when /\A\/?revisions\/[a-zA-Z0-9_-]+\/objs\/mget\Z/
_, _, revision_id, _, _ = *resource_path.split("/")
Fiona7::Controllers::RestAPI::ObjController.new.fetch_multiple(revision_id, payload)
when /\A\/?revisions\/[a-zA-Z0-9_-]+\/objs\/[a-zA-Z0-9_-]+\Z/
@@ -66,11 +66,10 @@
Fiona7::Controllers::RestAPI::BlobController.new.fetch(blob_id, payload[:transformation])
when /\A\/?blobs\/[a-zA-Z0-9_-]+\/meta_data\Z/
_, _, blob_id = *resource_path.split("/")
Fiona7::Controllers::RestAPI::BlobController.new.metadata(blob_id)
else
- $stdout.puts "GET: #{resource_path}"
original_get(resource_path, payload, options||{})
end
end
end
@@ -91,11 +90,10 @@
Fiona7::Controllers::RestAPI::WorkspaceController.new.delete(workspace_id)
when /\A\/?workspaces\/[a-zA-Z0-9_-]+\/objs\/[a-zA-Z0-9_-]+\Z/
_, _, workspace_id, _, obj_id = *resource_path.split("/")
Fiona7::Controllers::RestAPI::ObjController.new.destroy(workspace_id, obj_id)
else
- #$stdout.puts "DELETE: #{resource_path}"
original_delete(resource_path, payload, options||{})
end
end
alias_method :original_post, :post
@@ -104,19 +102,18 @@
if !resource_path.start_with?('/')
resource_path = '/' + resource_path
end
- #$stdout.puts "DEBUG POST: #{resource_path}"
+ #Rails.logger.debug "F7 REST POST: #{resource_path}"
case resource_path
when /\A\/?workspaces\Z/
Fiona7::Controllers::RestAPI::WorkspaceController.new.create(payload)
when /\A\/?workspaces\/[a-zA-Z0-9]+\/objs/
_, _, workspace_id = *resource_path.split("/")
Fiona7::Controllers::RestAPI::ObjController.new.create(workspace_id, payload)
else
- #$stdout.puts "POST: #{resource_path}"
original_post(resource_path, payload, options||{})
end
end
alias_method :original_put, :put
@@ -125,11 +122,11 @@
if !resource_path.start_with?('/')
resource_path = '/' + resource_path
end
- #$stdout.puts "DEBUG PUT: #{resource_path}"
+ #Rails.logger.debug "F7 PUT: #{resource_path}"
case resource_path
when /\A\/?workspaces\/[a-zA-Z0-9]+\/objs\/[a-zA-Z0-9]+\Z/
_, _, workspace_id, _, obj_id = *resource_path.split("/")
payload[:obj][:_id] = obj_id
Fiona7::Controllers::RestAPI::ObjController.new.update(workspace_id, payload)
@@ -141,11 +138,13 @@
_, _, workspace_id = *resource_path.split("/")
Fiona7::Controllers::RestAPI::WorkspaceController.new.publish(workspace_id)
when /\A\/?workspaces\/[a-zA-Z0-9]+/
_, _, workspace_id = *resource_path.split("/")
Fiona7::Controllers::RestAPI::WorkspaceController.new.update(workspace_id)
+ when /\A\/?blobs\/[a-zA-Z0-9]+\/copy/
+ _, _, blob_id, _ = * resource_path.split("/")
+ Fiona7::Controllers::RestAPI::BlobController.new.copy(blob_id, payload)
else
- #$stdout.puts "PUT: #{resource_path}"
original_put(resource_path, payload, options||{})
end
end
end
end