Sha256: cf7f343aceaa83c1125238ec674f0781e73015018ffc83d727c114fecbaabac4

Contents?: true

Size: 629 Bytes

Versions: 33

Compression:

Stored size: 629 Bytes

Contents

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

module Fog
  module Slicehost

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

    class Servers < Fog::Collection

      model Fog::Slicehost::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

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
fog-0.2.30 lib/fog/slicehost/models/servers.rb
fog-0.2.28 lib/fog/slicehost/models/servers.rb
fog-0.2.27 lib/fog/slicehost/models/servers.rb
fog-0.2.26 lib/fog/slicehost/models/servers.rb
fog-0.2.25 lib/fog/slicehost/models/servers.rb
fog-0.2.24 lib/fog/slicehost/models/servers.rb
tecnh-fog-0.2.23.vpc lib/fog/slicehost/models/servers.rb
fog-0.2.23 lib/fog/slicehost/models/servers.rb
fog-0.2.22 lib/fog/slicehost/models/servers.rb
fog-0.2.21 lib/fog/slicehost/models/servers.rb
fog-0.2.20 lib/fog/slicehost/models/servers.rb
fog-0.2.19 lib/fog/slicehost/models/servers.rb
fog-0.2.18 lib/fog/slicehost/models/servers.rb
fog-0.2.17 lib/fog/slicehost/models/servers.rb
fog-0.2.16 lib/fog/slicehost/models/servers.rb
fog-0.2.15 lib/fog/slicehost/models/servers.rb
fog-0.2.14 lib/fog/slicehost/models/servers.rb
fog-0.2.13 lib/fog/slicehost/models/servers.rb
fog-0.2.12 lib/fog/slicehost/models/servers.rb
fog-0.2.11 lib/fog/slicehost/models/servers.rb