2011-01-19 15:47:35 -05:00
|
|
|
module Fog
|
|
|
|
module Voxel
|
|
|
|
class Compute < Fog::Service
|
|
|
|
|
|
|
|
requires :voxel_api_key, :voxel_api_secret
|
|
|
|
|
|
|
|
model_path 'fog/compute/models/voxel'
|
|
|
|
model :image
|
|
|
|
collection :images
|
2011-01-19 17:07:04 -05:00
|
|
|
model :server
|
|
|
|
collection :servers
|
2011-01-19 15:47:35 -05:00
|
|
|
|
|
|
|
request_path 'fog/compute/requests/voxel'
|
|
|
|
request :images_list
|
2011-01-19 17:07:04 -05:00
|
|
|
request :devices_list
|
2011-01-19 19:17:23 -05:00
|
|
|
request :voxcloud_create
|
|
|
|
request :voxcloud_status
|
2011-01-19 15:47:35 -05:00
|
|
|
|
|
|
|
class Mock
|
|
|
|
include Collections
|
|
|
|
end
|
|
|
|
|
|
|
|
class Real
|
|
|
|
include Collections
|
|
|
|
|
|
|
|
def initialize(options = {})
|
|
|
|
require 'hapi'
|
|
|
|
@connection = HAPI.new( :authkey => { :key => options[:voxel_api_key], :secret => options[:voxel_api_secret] }, :default_format => :ruby )
|
|
|
|
end
|
|
|
|
|
2011-01-19 17:07:04 -05:00
|
|
|
def request(method_name, options = {})
|
|
|
|
api_method_name = @connection.translate_api_to_method( method_name )
|
|
|
|
@connection.send(api_method_name, options)
|
2011-01-19 15:47:35 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|