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.0.66 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.65 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.64 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.63 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.62 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.61 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.60 lib/fog/rackspace/models/servers/servers.rb
fog-0.0.59 lib/fog/rackspace/models/servers/servers.rb