1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/openstack/models/volume/volumes.rb
Paul Thornthwaite 330a351ade Remove trailing blank lines
Done with `rubocop --auto-correct --only TrailingBlankLines`
2014-05-26 14:35:26 +01:00

28 lines
810 B
Ruby

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(options = {:detailed => true})
# the parameter has been "detailed = true" before. Make sure we are
# backwards compatible
detailed = options.is_a?(Hash) ? options.delete(:detailed) : options
load(service.list_volumes(detailed, options).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