mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
2a9224cfa7
Added basic spec framework; changed class names to match the template fog seems to prefer Servers tests pass; create and delete implemented. Added an example script Properly handle a 409 response from the API Fixed BBG code to work with the new api endpoint changes; tweaks to the (currently nonexistent) reboot api call Implement the reboot command for blocks
41 lines
739 B
Ruby
41 lines
739 B
Ruby
require 'fog/collection'
|
|
require 'fog/bluebox/models/image'
|
|
|
|
module Fog
|
|
module Bluebox
|
|
|
|
class Mock
|
|
def images(attributes = {})
|
|
Fog::Bluebox::Images.new({
|
|
:connection => self
|
|
}.merge!(attributes))
|
|
end
|
|
end
|
|
|
|
class Real
|
|
def images(attributes = {})
|
|
Fog::Bluebox::Images.new({
|
|
:connection => self
|
|
}.merge!(attributes))
|
|
end
|
|
end
|
|
|
|
class Templates < Fog::Collection
|
|
|
|
model Fog::Bluebox::Image
|
|
|
|
def all
|
|
data = connection.get_templates.body['templates']
|
|
load(data)
|
|
end
|
|
|
|
def get(template_id)
|
|
connection.get_image(template_id)
|
|
rescue Excon::Errors::Forbidden
|
|
nil
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
end
|