Sha256: ed79b06bbdeef229aa460a0b12c657ddc6bab041c532019e55270638f6b3ee63

Contents?: true

Size: 603 Bytes

Versions: 5

Compression:

Stored size: 603 Bytes

Contents

module Fog
  class Slicehost

    def images(attributes = {})
      Fog::Slicehost::Images.new({
        :connection => self
      }.merge!(attributes))
    end

    class Images < Fog::Collection

      model Fog::Slicehost::Image

      def all
        if @loaded
          clear
        end
        @loaded = true
        data = connection.get_images.body
        for image in data['images']
          self << new(image)
        end
        self
      end

      def get(image_id)
        connection.get_image(image_id)
      rescue Excon::Errors::Forbidden
        nil
      end

    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fog-0.0.47 lib/fog/slicehost/models/images.rb
fog-0.0.46 lib/fog/slicehost/models/images.rb
fog-0.0.45 lib/fog/slicehost/models/images.rb
fog-0.0.44 lib/fog/slicehost/models/images.rb
fog-0.0.43 lib/fog/slicehost/models/images.rb