You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by dk...@apache.org on 2013/04/05 05:31:17 UTC

git commit: Core: Added url_for helpers for Rabbit subcollections (DTACLOUD-526)

Updated Branches:
  refs/heads/master 2a53220f0 -> 9c2550a32


Core: Added url_for helpers for Rabbit subcollections (DTACLOUD-526)

This patch add URL helpers for all Rabbit subcollections, like:

system_volumes(:id => system_id)
=>  "http://localhost:3001/cimi/systems/system_id/volumes"

system_volumes(:id => system_id, :ent_id => volume_id)
=>  "http://localhost:3001/cimi/systems/system_id/volumes/volume_id"

Signed-off-by: Michal fojtik <mf...@redhat.com>
TrackedAt: http://tracker.deltacloud.org/patch/a5307a0c00bc341d90eb40d575ff73af30dd343f


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/9c2550a3
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/9c2550a3
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/9c2550a3

Branch: refs/heads/master
Commit: 9c2550a321e53f1a38d8c4019281ebe79a02c7e1
Parents: 2a53220
Author: Michal Fojtik <mf...@redhat.com>
Authored: Thu Apr 4 16:55:22 2013 +0200
Committer: Dies Koper <di...@fast.au.fujitsu.com>
Committed: Fri Apr 5 14:31:03 2013 +1100

----------------------------------------------------------------------
 server/lib/deltacloud/helpers/rabbit_helper.rb |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/9c2550a3/server/lib/deltacloud/helpers/rabbit_helper.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/helpers/rabbit_helper.rb b/server/lib/deltacloud/helpers/rabbit_helper.rb
index a8ae4f5..b249dc6 100644
--- a/server/lib/deltacloud/helpers/rabbit_helper.rb
+++ b/server/lib/deltacloud/helpers/rabbit_helper.rb
@@ -45,6 +45,7 @@ module Sinatra::Rabbit
       c.operations.each do |operation|
         URLHelper.instance_eval(&generate_url_helper_for(c, operation)[0])
       end
+      URLFor(c.collections)
     end
     URLHelper
   end
@@ -53,6 +54,10 @@ module Sinatra::Rabbit
     operation_name = operation.operation_name.to_s
     collection_name = collection.collection_name.to_s
 
+    if collection.subcollection?
+      collection_name = "#{collection.parent_collection.collection_name.to_s.singularize}_#{collection_name}"
+    end
+
     # Construct OPERATION_COLLECTION_URL helper
     # The :index and :create operation does not get any prefix
     #