Sha256: a2bae95cee13d7e106a4af539a5617f2a7eb223e3adbbff5a4b5a9fba7286a90

Contents?: true

Size: 659 Bytes

Versions: 1

Compression:

Stored size: 659 Bytes

Contents

require File.expand_path('../image', __FILE__)
require File.expand_path('../../helpers/compute/data_helper', __dir__)

module Fog
  module Compute
    class ProfitBricks
      class Images < Fog::Collection
        include Fog::Helpers::ProfitBricks::DataHelper
        model Fog::Compute::ProfitBricks::Image

        def all
          result = service.get_all_images

          load(result.body['items'].each {|img| flatten(img)})
        end

        def get(id)
          image = service.get_image(id).body

          Excon::Errors
          new(flatten(image))
        rescue Excon::Errors::NotFound
          nil
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-profitbricks-2.0.1 lib/fog/profitbricks/models/compute/images.rb