You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Tobias Crawley <tc...@gmail.com> on 2010/11/13 05:31:51 UTC

[PATCH 1/2] Allow client object actions take arguments.

---
 client/lib/base_object.rb |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/client/lib/base_object.rb b/client/lib/base_object.rb
index ddd1b9f..295968c 100644
--- a/client/lib/base_object.rb
+++ b/client/lib/base_object.rb
@@ -172,7 +172,7 @@ module DeltaCloud
           base_method_handler(m, args)
         rescue NoHandlerForMethod
           case m[:type]
-            when :action_link then do_action(m)
+            when :action_link then do_action(m, args)
             else raise NoHandlerForMethod
           end
         end
@@ -180,8 +180,13 @@ module DeltaCloud
 
       private
 
-      def do_action(m)
-        @client.request(:"#{m[:method]}", m[:href], {}, {})
+      def do_action(m, args)
+        args = args.first || {}
+        method = m[:method].to_sym
+        @client.request(method,
+                        m[:href],
+                        method == :get ? args : {},
+                        method == :get ? {} : args)
         action_trigger(m[:rel])
       end
 
-- 
1.7.2.3