Class: Fog::Compute::Ecloud::Environments

Inherits:
Ecloud::Collection show all
Defined in:
lib/fog/ecloud/models/compute/environments.rb

Constant Summary collapse

Vdcs =
Environments

Instance Method Summary collapse

Methods inherited from Ecloud::Collection

#check_href!, #load

Instance Method Details

#allObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fog/ecloud/models/compute/environments.rb', line 13

def all
  data = []
  service.get_organization(href).body[:Locations][:Location].each do |d|
    environments = d[: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) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/fog/ecloud/models/compute/environments.rb', line 27

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