Class: Fog::Rackspace::Servers::Images

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/rackspace/models/servers/images.rb

Instance Method Summary collapse

Methods inherited from Collection

#_dump, _load, aliases, attribute, attributes, #attributes, #connection, #connection=, #create, #initialize, #inspect, #load, #merge_attributes, #model, model, #new, #reload, #table

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#allObject



17
18
19
20
21
22
23
# File 'lib/fog/rackspace/models/servers/images.rb', line 17

def all
  data = connection.list_images_detail.body['images']
  load(images)
  if server
    self.replace(self.select {|image| image.server_id == server.id})
  end
end

#get(image_id) ⇒ Object



25
26
27
28
29
# File 'lib/fog/rackspace/models/servers/images.rb', line 25

def get(image_id)
  connection.get_image_details(image_id)
rescue Excon::Errors::NotFound
  nil
end