Sha256: d7530a48762d3d673a16519e7ed092f5ff40ad6ee4089ab46c60c3607f16afcd

Contents?: true

Size: 979 Bytes

Versions: 8

Compression:

Stored size: 979 Bytes

Contents

require 'lib/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

8 entries across 8 versions & 1 rubygems

Version Path
fog-0.3.7 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
fog-0.3.6 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
fog-0.3.5 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
fog-0.3.4 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
fog-0.3.3 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
fog-0.3.2 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
fog-0.3.1 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb
fog-0.3.0 lib/fog/vcloud/terremark/ecloud/models/vdcs.rb