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

43 lines
763 B
Ruby
Raw Normal View History

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
2010-06-02 01:01:10 -04:00
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)
2010-06-02 01:01:10 -04:00
new(response.body)
2010-06-02 22:43:58 -04:00
rescue Excon::Errors::NotFound
nil
end
end
end
end