Class: Fog::OpenStack::Compute::Networks

Inherits:
Fog::OpenStack::Collection show all
Defined in:
lib/fog/openstack/compute/models/networks.rb

Instance Attribute Summary

Attributes inherited from Fog::OpenStack::Collection

#response

Instance Method Summary collapse

Methods inherited from Fog::OpenStack::Collection

#destroy, #find_by_id, #get, #load_response, #summary

Instance Method Details

#allObject



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

def all
  requires :server

  networks = []
  server.addresses.each_with_index do |address, index|
    networks << {
      :id        => index + 1,
      :name      => address[0],
      :addresses => address[1].map { |a| a['addr'] }
    }
  end

  # TODO: convert to load_response?
  load(networks)
end