Sha256: 88603215923bc7adf8b12980ff393b3037b63ca62e1ce7c6b8e2f86e580931ab

Contents?: true

Size: 975 Bytes

Versions: 9

Compression:

Stored size: 975 Bytes

Contents

require 'fog/vcloud/terremark/ecloud/models/vdc'

module Fog
  class Vcloud
    module Terremark
      class Ecloud

        class Vdcs < Collection

          model Fog::Vcloud::Terremark::Ecloud::Vdc

          def all
            data = connection.get_organization(organization_uri).body[:Link].select { |link| link[:type] == "application/vnd.vmware.vcloud.vdc+xml" }
            data.each { |link| link.delete_if { |key, value| [:rel].include?(key) } }
            load(data)
          end

          def get(uri)
            if data = connection.get_vdc(uri)
              new(data.body)
            end
          rescue Fog::Errors::NotFound
            nil
          end

          def organization_uri
            @organizatio_uri ||= connection.default_organization_uri
          end

          private

          def organization_uri=(new_organization_uri)
            @organization_uri = new_organization_uri
          end

        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fog-0.3.16 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
fog-0.3.15 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
fog-0.3.14 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
fog-0.3.13 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
fog-0.3.12 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
fog-0.3.11 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
fog-0.3.10 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
fog-0.3.9 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
fog-0.3.8 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb