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
|
2010-09-03 04:11:45 -04:00
|
|
|
class Bluebox
|
2010-05-24 13:29:01 -04:00
|
|
|
|
2010-06-02 01:01:10 -04:00
|
|
|
class Images < Fog::Collection
|
2010-05-24 13:29:01 -04:00
|
|
|
|
2010-05-24 14:03:52 -04:00
|
|
|
model Fog::Bluebox::Image
|
2010-05-24 13:29:01 -04:00
|
|
|
|
|
|
|
def all
|
2010-06-02 22:38:50 -04:00
|
|
|
data = connection.get_templates.body
|
2010-05-24 13:29:01 -04:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
def get(template_id)
|
2010-06-02 11:44:51 -04:00
|
|
|
response = connection.get_template(template_id)
|
2010-06-02 01:01:10 -04:00
|
|
|
new(response.body)
|
2010-06-02 22:56:50 -04:00
|
|
|
rescue Fog::Bluebox::NotFound
|
2010-05-24 13:29:01 -04:00
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|