You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2011/08/09 22:28:26 UTC

svn commit: r1155550 - in /incubator/deltacloud/trunk/client/lib: base_object.rb deltacloud.rb

Author: mfojtik
Date: Tue Aug  9 20:28:25 2011
New Revision: 1155550

URL: http://svn.apache.org/viewvc?rev=1155550&view=rev
Log:
Client: Added authentication block

Modified:
    incubator/deltacloud/trunk/client/lib/base_object.rb
    incubator/deltacloud/trunk/client/lib/deltacloud.rb

Modified: incubator/deltacloud/trunk/client/lib/base_object.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/client/lib/base_object.rb?rev=1155550&r1=1155549&r2=1155550&view=diff
==============================================================================
--- incubator/deltacloud/trunk/client/lib/base_object.rb (original)
+++ incubator/deltacloud/trunk/client/lib/base_object.rb Tue Aug  9 20:28:25 2011
@@ -79,6 +79,22 @@ module DeltaCloud
         }
       end
 
+      def add_authentication!(auth_type, values=[])
+        value = { :key => (values/'login/keyname').text.strip } if auth_type == 'key'
+        if auth_type == 'password'
+          value = {
+            :username => (values/'login/username').text.strip,
+            :username => (values/'login/password').text.strip
+          }
+        end
+        @objects << {
+          :type => :collection,
+          :method_name => 'authentication',
+          :values => value
+        }
+      end
+      
+
       # This method define collection of text elements inside REST model
       # XML syntax: <addresses>
       #               <address>127.0.0.1</address>

Modified: incubator/deltacloud/trunk/client/lib/deltacloud.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/client/lib/deltacloud.rb?rev=1155550&r1=1155549&r2=1155550&view=diff
==============================================================================
--- incubator/deltacloud/trunk/client/lib/deltacloud.rb (original)
+++ incubator/deltacloud/trunk/client/lib/deltacloud.rb Tue Aug  9 20:28:25 2011
@@ -238,6 +238,10 @@ module DeltaCloud
           obj.add_addresses!(attribute.name, (attribute/'*')) && next
         end
 
+        if ('authentication'.include? attribute.name)
+          obj.add_authentication!(attribute[:type], (attribute/'*')) && next
+        end
+
         # Deal with collections like public-addresses, private-addresses
         if (attribute/'./*').length > 0
           obj.add_collection!(attribute.name, (attribute/'*').collect { |value| value.text }) && next