Sha256: 832e070f33c15b165f3033cebbf68d84545e550095bd96e0b177d6b63f621122

Contents?: true

Size: 816 Bytes

Versions: 48

Compression:

Stored size: 816 Bytes

Contents

require 'fog/collection'
require 'fog/rackspace/models/servers/server'

module Fog
  module Rackspace
    module Servers

      class Mock
        def servers
          Fog::Rackspace::Servers::Servers.new(:connection => self)
        end
      end

      class Real
        def servers
          Fog::Rackspace::Servers::Servers.new(:connection => self)
        end
      end

      class Servers < Fog::Collection

        model Fog::Rackspace::Servers::Server

        def all
          data = connection.list_servers_detail.body['servers']
          load(data)
        end

        def get(server_id)
          if server = connection.get_server_details(server_id).body['server']
            new(server)
          end
        rescue Excon::Errors::NotFound
          nil
        end

      end

    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
fog-0.1.5 lib/fog/rackspace/models/servers/servers.rb
fog-0.1.4 lib/fog/rackspace/models/servers/servers.rb
fog-0.1.3 lib/fog/rackspace/models/servers/servers.rb
fog-0.1.2 lib/fog/rackspace/models/servers/servers.rb
fog-0.1.1 lib/fog/rackspace/models/servers/servers.rb
fog-0.1.0 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.100 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.99 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.98 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.97 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.96 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.95 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.94 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.93 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.92 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.91 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.90 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.89 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.88 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.87 lib/fog/rackspace/models/servers/servers.rb