2010-03-17 20:51:55 -07:00
|
|
|
require 'fog/collection'
|
|
|
|
require 'fog/slicehost/models/image'
|
|
|
|
|
2010-02-06 15:39:14 -08:00
|
|
|
module Fog
|
2010-03-17 20:51:55 -07:00
|
|
|
module Slicehost
|
2010-02-06 15:39:14 -08:00
|
|
|
|
2010-06-12 15:31:17 -07:00
|
|
|
module Collections
|
2010-04-04 21:41:15 -07:00
|
|
|
def images(attributes = {})
|
|
|
|
Fog::Slicehost::Images.new({
|
|
|
|
:connection => self
|
|
|
|
}.merge!(attributes))
|
|
|
|
end
|
2010-02-06 15:39:14 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
class Images < Fog::Collection
|
|
|
|
|
|
|
|
model Fog::Slicehost::Image
|
|
|
|
|
|
|
|
def all
|
2010-03-06 20:02:10 -08:00
|
|
|
data = connection.get_images.body['images']
|
|
|
|
load(data)
|
2010-02-06 15:39:14 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
def get(image_id)
|
|
|
|
connection.get_image(image_id)
|
|
|
|
rescue Excon::Errors::Forbidden
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|