Sha256: 63de69e10e0fd33b5596229528ed2a9b30163f36e50d8a7f716f90195d4c1c4d

Contents?: true

Size: 598 Bytes

Versions: 7

Compression:

Stored size: 598 Bytes

Contents

require 'fog/core/collection'
require 'fog/openstack/models/volume/volume'

module Fog
  module Volume
    class OpenStack

      class Volumes < Fog::Collection
        model Fog::Volume::OpenStack::Volume

        def all(detailed=true)
          load(service.list_volumes(detailed).body['volumes'])
        end

        def get(volume_id)
          if volume = service.get_volume_details(volume_id).body['volume']
            new(volume)
          end
        rescue Fog::Volume::OpenStack::NotFound
          nil
        end
        alias_method :find_by_id, :get
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
fog-maestrodev-1.15.0.20130927082724 lib/fog/openstack/models/volume/volumes.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/openstack/models/volume/volumes.rb
fog-1.15.0 lib/fog/openstack/models/volume/volumes.rb
gapinc-fog-1.14.0 lib/fog/openstack/models/volume/volumes.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/openstack/models/volume/volumes.rb
fog-1.14.0 lib/fog/openstack/models/volume/volumes.rb
fog-1.13.0 lib/fog/openstack/models/volume/volumes.rb