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

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/rackspace/models/servers/servers.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



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

def all
  data = connection.list_servers_detail.body['servers']
  load(data)
end

#get(server_id) ⇒ Object



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

def get(server_id)
  if server = connection.get_server_details(server_id).body['server']
    new(server)
  end
rescue Excon::Errors::NotFound
  nil
end