Sha256: 04746e4dd892ba91d65244277d7e2a416878ee547536405a990b9e52d77aa093

Contents?: true

Size: 690 Bytes

Versions: 1

Compression:

Stored size: 690 Bytes

Contents

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

module Fog
  module Compute
    class ProfitBricks
      class Locations < Fog::Collection
        include Fog::Helpers::ProfitBricks::DataHelper
        model Fog::Compute::ProfitBricks::Location

        def all
          result = service.get_all_locations

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

        def get(id)
          location = service.get_location(id).body

          Excon::Errors
          new(flatten(location))
        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/locations.rb