1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/brightbox/requests/compute/get_account.rb
Paul Thornthwaite fb13fd981d [Brightbox] Deprecates overloaded requests
Fog::Compute::Brightbox::Real#get_user and #get_account were overloaded
to return the currently authenticated user or the scoped account
respectively if no identifier was passed.

This is strictly wrong because the requests should map to one API
endpoint but these now switch between two.

Behaviour is deprecated and will be removed at a suitable point in the
future.
2012-11-02 18:55:33 +00:00

37 lines
1.1 KiB
Ruby

module Fog
module Compute
class Brightbox
class Real
# Requests details about an account from the API
#
# === Parameters:
#
# <tt>identifier <String></tt>:: The identifier to request (Default is +nil+)
#
# === Returns:
#
# <tt>Hash</tt>:: The JSON response parsed to a Hash
#
# === Notes:
#
# This also supports a deprecated form where if an identifier is not
# passed then the scoping account is returned instead. This should not
# be used in new code. Use #get_scoped_account instead.
#
# === Reference:
#
# https://api.gb1.brightbox.com/1.0/#account_get_account
#
def get_account(identifier = nil)
if identifier.nil? || identifier.empty?
Fog::Logger.deprecation("get_account() without a parameter is deprecated, use get_scoped_account instead [light_black](#{caller.first})[/]")
get_scoped_account
else
request("get", "/1.0/accounts/#{identifier}", [200])
end
end
end
end
end
end