lib/fog/vcloud_director/requests/compute/get_organizations.rb in fog-maestrodev-1.15.0.20130927082724 vs lib/fog/vcloud_director/requests/compute/get_organizations.rb in fog-maestrodev-1.18.0.20131111203459

- old
+ new

@@ -1,30 +1,45 @@ module Fog module Compute class VcloudDirector class Real + # Retrieve a list of organizations accessible to you. + # + # The system administrator has access to all organizations. + # + # @return [Excon::Response] + # * body<~Hash>: + # * :href<~String> - The URI of the entity. + # * :type<~String> - The MIME type of the entity. + # * :Org<~Array<Hash>]: + # * :href<~String> - Contains the URI to the linked entity. + # * :name<~String> - Contains the name of the linked entity. + # * :type<~String> - Contains the type of the linked entity. + # + # @see http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Organizations.html + # @since vCloud API version 0.9 def get_organizations - request({ - :expects => 200, - :method => 'GET', - :parser => Fog::ToHashDocument.new, - :path => 'org' - }) + response = request( + :expects => 200, + :idempotent => true, + :method => 'GET', + :parser => Fog::ToHashDocument.new, + :path => 'org' + ) + ensure_list! response.body, :Org + response end end class Mock def get_organizations body = - {:xmlns=>xmlns, - :xmlns_xsi=>xmlns_xsi, + {:href=>make_href('org/'), :type=>"application/vnd.vmware.vcloud.orgList+xml", - :href=>make_href('org/'), - :xsi_schemaLocation=>xsi_schema_location, :Org=> - {:type=>"application/vnd.vmware.vcloud.org+xml", - :name=>data[:org][:name], - :href=>make_href("org/#{data[:org][:uuid]}")}} + [{:href=>make_href("org/#{data[:org][:uuid]}"), + :name=>data[:org][:name], + :type=>"application/vnd.vmware.vcloud.org+xml"}]} Excon::Response.new( :body => body, :headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"}, :status => 200