2010-05-24 13:29:01 -04:00
|
|
|
require 'fog/collection'
|
2010-05-24 14:03:52 -04:00
|
|
|
require 'fog/bluebox/models/image'
|
2010-05-24 13:29:01 -04:00
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Bluebox
|
|
|
|
|
|
|
|
class Mock
|
|
|
|
def images(attributes = {})
|
2010-05-24 14:03:52 -04:00
|
|
|
Fog::Bluebox::Images.new({
|
2010-05-24 13:29:01 -04:00
|
|
|
:connection => self
|
|
|
|
}.merge!(attributes))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Real
|
|
|
|
def images(attributes = {})
|
2010-05-24 14:03:52 -04:00
|
|
|
Fog::Bluebox::Images.new({
|
2010-05-24 13:29:01 -04:00
|
|
|
:connection => self
|
|
|
|
}.merge!(attributes))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Templates < Fog::Collection
|
|
|
|
|
2010-05-24 14:03:52 -04:00
|
|
|
model Fog::Bluebox::Image
|
2010-05-24 13:29:01 -04:00
|
|
|
|
|
|
|
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
|