class Fog::Compute::Ecloud::Vdcs

Constants

Vdcs

Public Instance Methods

all() click to toggle source
# File lib/fog/compute/ecloud/models/environments.rb, line 13
def all
  data = []
  raw_location = service.get_organization(href).body[:Locations][:Location]
  if raw_location.is_a?(Array)
    # If there's more than one location, the XML parser returns an
    # array.
    location = raw_location
  else
    # Otherwise it returns a hash.
    location = [raw_location]
  end

  location.each do |l|
    environments = l[:Environments]
    next unless environments
    if environments[:Environment].is_a?(Array)
      environments[:Environment].each { |e| data << e }
    else
      data << environments[:Environment]
    end
  end
  load(data)
end
get(uri) click to toggle source
# File lib/fog/compute/ecloud/models/environments.rb, line 37
def get(uri)
  if data = service.get_environment(uri)
    new(data.body)
  end
rescue ServiceError => e
  raise e unless e.status_code == 404
  nil
end