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/compute/models/voxel/servers.rb

32 lines
634 B
Ruby
Raw Normal View History

2011-01-19 17:07:04 -05:00
require 'fog/core/collection'
require 'fog/compute/models/voxel/server'
module Fog
module Voxel
class Compute
class Servers < Fog::Collection
model Fog::Voxel::Compute::Server
def all
2011-02-23 18:00:56 -05:00
data = connection.devices_list.body['devices'].select {|device| device['type']['id'] == '3'}
2011-01-19 17:07:04 -05:00
load(data)
end
def get(device_id)
2011-02-23 18:00:56 -05:00
if device_id && server = connection.devices_list(device_id).body['devices']
2011-02-23 18:00:56 -05:00
if server.empty?
nil
else
new(server.first)
end
2011-01-19 17:07:04 -05:00
end
end
end
end
end
end