Sha256: 802eb6cdd034a0c0fd5cf9f2a161d51c37d4c8721f0c6b1f1b6e0f232f625a63

Contents?: true

Size: 691 Bytes

Versions: 1

Compression:

Stored size: 691 Bytes

Contents

require File.expand_path('../datacenter', __FILE__)
require File.expand_path('../../helpers/compute/data_helper', __dir__)

module Fog
  module Compute
    class ProfitBricks
      class Datacenters < Fog::Collection
        include Fog::Helpers::ProfitBricks::DataHelper
        model Fog::Compute::ProfitBricks::Datacenter

        def all
          result = service.get_all_datacenters

          load(result.body['items'].each {|dc| flatten(dc)})
        end

        def get(id)
          datacenter = service.get_datacenter(id).body

          Excon::Errors
          new(flatten(datacenter))
        rescue Excon::Errors::NotFound
          nil
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-profitbricks-2.0.1 lib/fog/profitbricks/models/compute/datacenters.rb