Sha256: b97ba249768a223801ca97f104aab9a504e20692432db3985261249db9d2f76b

Contents?: true

Size: 747 Bytes

Versions: 13

Compression:

Stored size: 747 Bytes

Contents

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

module Fog
  module Compute
    class Voxel
      class Servers < Fog::Collection
        model Fog::Compute::Voxel::Server

        def all
          data = service.devices_list.body['devices'].select {|device| device['type']['id'] == '3'}
          load(data)
        end

        def get(device_id)
          if device_id && server = service.devices_list(device_id).body['devices']
            new(server.first)
          end
        rescue Fog::Service::Error => error
          if error.message == "The device_id passed in can't be matched to a valid device."
            nil
          else
            raise error
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/voxel/models/compute/servers.rb
fog-1.24.0 lib/fog/voxel/models/compute/servers.rb
ns-fog-1.22.11 lib/fog/voxel/models/compute/servers.rb
ns-fog-1.22.10 lib/fog/voxel/models/compute/servers.rb
ns-fog-1.22.9 lib/fog/voxel/models/compute/servers.rb
ns-fog-1.22.8 lib/fog/voxel/models/compute/servers.rb
ns-fog-1.22.7 lib/fog/voxel/models/compute/servers.rb
ns-fog-1.22.6 lib/fog/voxel/models/compute/servers.rb
fog-1.23.0 lib/fog/voxel/models/compute/servers.rb
ns-fog-1.22.4 lib/fog/voxel/models/compute/servers.rb
ns-fog-1.22.3 lib/fog/voxel/models/compute/servers.rb
ns-fog-1.22.2 lib/fog/voxel/models/compute/servers.rb
fog-1.22.1 lib/fog/voxel/models/compute/servers.rb