Sha256: 0a48606963f3d01f78089e1a73c188c2c872668903824d19809703f2aebbaccb

Contents?: true

Size: 762 Bytes

Versions: 3

Compression:

Stored size: 762 Bytes

Contents

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 Fog::Bluebox::NotFound
        nil
      end

    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-0.1.8 lib/fog/bluebox/models/images.rb
fog-0.1.7 lib/fog/bluebox/models/images.rb
fog-0.1.6 lib/fog/bluebox/models/images.rb