Sha256: 66664bd020d59b5380a96e8b390c79939966df1c692a79bb756d67539e2b646c

Contents?: true

Size: 587 Bytes

Versions: 7

Compression:

Stored size: 587 Bytes

Contents

require 'fog/collection'
require 'fog/slicehost/models/compute/server'

module Fog
  module Slicehost
    class Compute

      class Servers < Fog::Collection

        model Fog::Slicehost::Compute::Server

        def all
          data = connection.get_slices.body['slices']
          load(data)
        end

        def get(server_id)
          if server_id && server = connection.get_slice(server_id).body
            new(server)
          elsif !server_id
            nil
          end
        rescue Excon::Errors::Forbidden
          nil
        end

      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fog-0.3.6 lib/fog/slicehost/models/compute/servers.rb
fog-0.3.5 lib/fog/slicehost/models/compute/servers.rb
fog-0.3.4 lib/fog/slicehost/models/compute/servers.rb
fog-0.3.3 lib/fog/slicehost/models/compute/servers.rb
fog-0.3.2 lib/fog/slicehost/models/compute/servers.rb
fog-0.3.1 lib/fog/slicehost/models/compute/servers.rb
fog-0.3.0 lib/fog/slicehost/models/compute/servers.rb