Sha256: 7dd6f2a45f68cc7fbb81df01ea1b15c87206f74d3197647e8fa2eb3497b2aa64

Contents?: true

Size: 1.46 KB

Versions: 7

Compression:

Stored size: 1.46 KB

Contents

module Fog
  module Ecloud
    class Compute

      class Real
        basic_request :get_catalog_item
      end

      class Mock

        #
        # Based on
        # http://support.theenterprisecloud.com/kb/default.asp?id=542&Lang=1&SID=
        #

        def get_catalog_item(catalog_item_uri)
          if catalog_item = mock_data.catalog_item_from_href(catalog_item_uri)
            builder = Builder::XmlMarkup.new

            xml = builder.CatalogItem(xmlns.merge(:href => catalog_item.href, :name => catalog_item.name)) do
              builder.Link(
                           :rel => "down",
                           :href => catalog_item.customization.href,
                           :type => "application/vnd.tmrk.ecloud.catalogItemCustomizationParameters+xml",
                           :name => catalog_item.customization.name
                           )

              builder.Entity(
                             :href => catalog_item.vapp_template.href,
                             :type => "application/vnd.vmware.vcloud.vAppTemplate+xml",
                             :name => catalog_item.vapp_template.name
                             )

              builder.Property(0, :key => "LicensingCost")
            end
          end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fog-0.8.2 lib/fog/compute/requests/ecloud/get_catalog_item.rb
fog-0.8.1 lib/fog/compute/requests/ecloud/get_catalog_item.rb
fog-0.8.0 lib/fog/compute/requests/ecloud/get_catalog_item.rb
fog-0.7.2 lib/fog/compute/requests/ecloud/get_catalog_item.rb
fog-0.7.1 lib/fog/compute/requests/ecloud/get_catalog_item.rb
fog-0.7.0 lib/fog/compute/requests/ecloud/get_catalog_item.rb
fog-0.6.0 lib/fog/compute/requests/ecloud/get_catalog_item.rb