Sha256: 3c5ad35794aff3f03b484e9d2ca78b23204396d4bc0ffadcf1315f514243cf96

Contents?: true

Size: 689 Bytes

Versions: 1

Compression:

Stored size: 689 Bytes

Contents

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

module Fog
  module Compute
    class ProfitBricks
      class Snapshots < Fog::Collection
        include Fog::Helpers::ProfitBricks::DataHelper
        model Fog::Compute::ProfitBricks::Snapshot

        def all
          result = service.get_all_snapshots

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

        def get(id)
          snapshot = service.get_snapshot(id).body

          Excon::Errors
          new(flatten(snapshot))
        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/snapshots.rb