Sha256: 53de60c42d248b3dc2eefbe5db1e49ffbd1ad9ce89e3b77ddb3f73426f4027b8

Contents?: true

Size: 521 Bytes

Versions: 6

Compression:

Stored size: 521 Bytes

Contents

require 'fog/core/collection'
require 'fog/digitalocean/models/compute/server'

module Fog
  module Compute
    class DigitalOcean

      class Servers < Fog::Collection
        model Fog::Compute::DigitalOcean::Server

        def all
          load service.list_servers.body['droplets']
        end

        def get(id)
          if server = service.get_server_details(id).body['droplet']
            new server
          end
        rescue Fog::Errors::NotFound
          nil
        end

      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cifrado-0.2.1 vendor/fog/lib/fog/digitalocean/models/compute/servers.rb
cifrado-0.2.0 vendor/fog/lib/fog/digitalocean/models/compute/servers.rb
cifrado-0.1.3 vendor/fog/lib/fog/digitalocean/models/compute/servers.rb
cifrado-0.1.2 vendor/fog/lib/fog/digitalocean/models/compute/servers.rb
cifrado-0.1.1 vendor/fog/lib/fog/digitalocean/models/compute/servers.rb
cifrado-0.1 vendor/fog/lib/fog/digitalocean/models/compute/servers.rb