Class: Fog::Terremark::Shared::Networks

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/terremark/models/shared/networks.rb

Instance Method Summary collapse

Instance Method Details

#allObject



19
20
21
22
23
24
# File 'lib/fog/terremark/models/shared/networks.rb', line 19

def all
  data = service.get_vdc(vdc_id).body['AvailableNetworks'].map do |network|
    service.get_network(network["href"].split("/").last).body
  end
  load(data)
end

#get(network_id) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/fog/terremark/models/shared/networks.rb', line 26

def get(network_id)
  if network_id && network = service.get_network(network_id).body
    new(network)
  elsif !network_id
    nil
  end
rescue Excon::Errors::Forbidden
  nil
end

#vdc_idObject



36
37
38
# File 'lib/fog/terremark/models/shared/networks.rb', line 36

def vdc_id
  @vdc_id ||= service.default_vdc_id
end