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/requests/voxel/voxcloud_delete.rb

33 lines
762 B
Ruby
Raw Normal View History

2011-02-09 17:03:02 -05:00
module Fog
module Voxel
class Compute
class Real
def voxcloud_delete( device_id )
options = { :device_id => device_id }
data = request("voxel.voxcloud.delete", options )
unless data['stat'] == 'ok'
raise "Error from Voxel hAPI: #{data['err']['msg']}"
end
true
end
end
class Mock
def voxcloud_delete( device_id )
device = @data[:servers].select { |d| d[:id] == device_id }
2011-02-09 17:03:02 -05:00
2011-02-20 14:39:37 -05:00
if device.empty?
raise Fog::Voxel::Compute::NotFound
else
@data[:servers] = @data[:servers].select { |d| d[:id] != device_id }
2011-02-20 14:39:37 -05:00
@data[:statuses].delete(device_id)
true
end
2011-02-09 17:03:02 -05:00
end
end
end
end
end