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 2010/07/22 15:46:07 UTC

svn commit: r966656 - in /incubator/deltacloud/trunk/client: lib/deltacloud.rb specs/instances_spec.rb

Author: mfojtik
Date: Thu Jul 22 13:46:07 2010
New Revision: 966656

URL: http://svn.apache.org/viewvc?rev=966656&view=rev
Log:
Fixed wrong block syntax in client code

Modified:
    incubator/deltacloud/trunk/client/lib/deltacloud.rb
    incubator/deltacloud/trunk/client/specs/instances_spec.rb

Modified: incubator/deltacloud/trunk/client/lib/deltacloud.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/client/lib/deltacloud.rb?rev=966656&r1=966655&r2=966656&view=diff
==============================================================================
--- incubator/deltacloud/trunk/client/lib/deltacloud.rb (original)
+++ incubator/deltacloud/trunk/client/lib/deltacloud.rb Thu Jul 22 13:46:07 2010
@@ -294,12 +294,20 @@ module DeltaCloud
       end
       logger << "[#{conf[:method].to_s.upcase}] #{conf[:path]}\n"
       if conf[:method].eql?(:post)
-        RestClient.send(:post, conf[:path], conf[:form_data], default_headers) do |response|
-          yield response.body if block_given?
+        RestClient.send(:post, conf[:path], conf[:form_data], default_headers) do |response, request, block|
+          if response.respond_to?('body')
+            yield response.body if block_given?
+          else
+            yield response.to_s if block_given?
+          end
         end
       else
-        RestClient.send(conf[:method], conf[:path], default_headers) do |response|
-          yield response.body if block_given?
+        RestClient.send(conf[:method], conf[:path], default_headers) do |response, request, block|
+          if response.respond_to?('body')
+            yield response.body if block_given?
+          else
+            yield response.to_s if block_given?
+          end
         end
       end
     end

Modified: incubator/deltacloud/trunk/client/specs/instances_spec.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/client/specs/instances_spec.rb?rev=966656&r1=966655&r2=966656&view=diff
==============================================================================
--- incubator/deltacloud/trunk/client/specs/instances_spec.rb (original)
+++ incubator/deltacloud/trunk/client/specs/instances_spec.rb Thu Jul 22 13:46:07 2010
@@ -33,9 +33,9 @@ describe "instances" do
         instance.owner_id.should_not be_nil
         instance.owner_id.should be_a( String )
         instance.image.should_not be_nil
-        instance.image.should be_a( DeltaCloud::Image )
+        instance.image.should be_a( DeltaCloud::API::Image )
         instance.hardware_profile.should_not be_nil
-        instance.hardware_profile.should be_a( DeltaCloud::HardwareProfile )
+        instance.hardware_profile.should be_a( DeltaCloud::API::HardwareProfile )
         instance.state.should_not be_nil
         instance.state.should be_a( String )
         instance.public_addresses.should_not be_nil