Sha256: f39e74abe4286ca46ea6d41bb0bce915a69ce23b97f7b071e7eb17013aaecf4c

Contents?: true

Size: 660 Bytes

Versions: 5

Compression:

Stored size: 660 Bytes

Contents

module Fog
  class Slicehost

    def servers
      Fog::Slicehost::Servers.new(:connection => self)
    end

    class Servers < Fog::Collection

      model Fog::Slicehost::Server

      def all
        if @loaded
          clear
        end
        @loaded = true
        data = connection.get_slices.body['slices']
        for server in data
          self << new(server)
        end
        self
      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

Version data entries

5 entries across 5 versions & 1 rubygems

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