incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Crawley <tcraw...@gmail.com>
Subject [PATCH 1/2] Allow client object actions take arguments.
Date Sat, 13 Nov 2010 04:31:51 GMT
---
 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


Mime
View raw message