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/bluebox/models/images.rb

42 lines
789 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 Images < Fog::Collection
model Fog::Bluebox::Image
def all
data = connection.get_templates.body
load(data)
end
def get(template_id)
response = connection.get_template(template_id)
new(response.body)
rescue Excon::Errors::Forbidden, Excon::Errors::NotFound
nil
end
end
end
end