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, #to_json

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#allObject


30
31
32
33
34
35
36
# File 'lib/fog/rackspace/models/servers/images.rb', line 30

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

#get(image_id) ⇒ Object


38
39
40
41
42
43
# File 'lib/fog/rackspace/models/servers/images.rb', line 38

def get(image_id)
  data = connection.get_image_details(image_id).body['image']
  new(data)
rescue Excon::Errors::NotFound
  nil
end