incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 06/14] Allow client object actions take arguments.
Date Mon, 15 Nov 2010 12:46:48 GMT
From: Tobias Crawley <tcrawley@redhat.com>

---
 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.3.2


Mime
View raw message