Sha256: cb2ccadf0ca480f30adb5c588178e29ea7dbb8432a03e003a80fdb2c05ac9038

Contents?: true

Size: 698 Bytes

Versions: 25

Compression:

Stored size: 698 Bytes

Contents

require 'fog/openstack/models/collection'
require 'fog/compute/openstack/models/network'

module Fog
  module Compute
    class OpenStack
      class Networks < Fog::OpenStack::Collection
        model Fog::Compute::OpenStack::Network

        attribute :server

        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
      end
    end
  end
end

Version data entries

25 entries across 23 versions & 3 rubygems

Version Path
fog-openstack-0.1.31 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.3.10 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.30 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.29 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.3.9 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.28 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.3.8 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.3.7 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.3.6 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.3.5 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.3.4 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.3.3 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.3.2 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.3.0 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.2.4 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.2.3 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.2.2 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.2.1 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.2.0 lib/fog/compute/openstack/models/networks.rb
fog-zj-0.1.28 lib/fog/compute/openstack/models/networks.rb