Sha256: 8d45fdf93b7534b888bf941ce6d39095ae6d50b2e933f52269d35f916e14aec0

Contents?: true

Size: 763 Bytes

Versions: 14

Compression:

Stored size: 763 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 # class Networks
    end # class OpenStack
  end # module Compute
end # module Fog

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
fog-openstack-0.1.25 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.24 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.23 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.22 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.21 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.20 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.19 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.18 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.17 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.15 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.14 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.13 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.12 lib/fog/compute/openstack/models/networks.rb
fog-openstack-0.1.11 lib/fog/compute/openstack/models/networks.rb