Sha256: dc4e618a4d4c0c04af8dd80bcb7c0d2eb106fb1addcfa0f94c4229c435e89018

Contents?: true

Size: 1.43 KB

Versions: 29

Compression:

Stored size: 1.43 KB

Contents

module Fog
  class Vcloud
    module Terremark
      class Ecloud

        class Real
          basic_request :get_catalog
        end

        class Mock
          def get_catalog(catalog_uri)
            catalog_uri = ensure_unparsed(catalog_uri)
            xml = nil

            if catalog = mock_data.catalog_from_href(catalog_uri)
              builder = Builder::XmlMarkup.new

              xml = builder.Catalog(xmlns.merge(
                                                :type => "application/vnd.vmware.vcloud.catalog+xml",
                                                :href => catalog.href,
                                                :name => catalog.name
                                    )) do |xml|
                xml.CatalogItems do |xml|
                  catalog.items.each do |catalog_item|
                    xml.CatalogItem(
                                    :type => "application/vnd.vmware.vcloud.catalogItem+xml",
                                    :href => catalog_item.href,
                                    :name => catalog_item.name
                                    )
                  end
                end
              end
            end

            if xml
              mock_it 200,
                xml, { 'Content-Type' => 'application/vnd.vmware.vcloud.catalog+xml' }
            else
              mock_error 200, "401 Unauthorized"
            end
          end
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 3 rubygems

Version Path
fog-0.5.3 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
fog-0.5.2 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
fog-0.5.1 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
fog-0.5.0 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
phpfog-fog-0.4.1.3 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
phpfog-fog-0.4.1.2 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
phpfog-fog-0.4.1.1 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
phpfog-fog-0.4.1 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
fog-0.4.1 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
fog-0.4.0 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
fog-0.3.34 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
fog-0.3.33 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
fog-0.3.32 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
fog-0.3.31 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
fog-0.3.30 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
fog-0.3.29 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
fog-0.3.28 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
fog-0.3.27 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
fog-0.3.26 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb
fog-0.3.25 lib/fog/vcloud/terremark/ecloud/requests/get_catalog.rb