module Fog
module Compute
class Brightbox
class Real
# Requests an update to the currently scoped account
#
# === Parameters:
#
# identifier :: The identifier to request (Default is +nil+)
# options :: Hash of options for update
#
# === Options:
#
# name:: Account name
# address_1:: First line of address
# address_2:: Second line of address
# city:: City part of address
# county:: County part of address
# postcode:: Postal code
# country_code:: ISO 3166-1 two letter code (example: +GB+)
# vat_registration_number:: Valid EU VAT Number or +nil+
# telephone_number:: Valid International telephone number in E.164 format prefixed with ’+’
#
# === Returns:
#
# Hash:: The JSON response parsed to a Hash
# nil:: If no options were passed to update
#
# === Notes:
#
# This also supports a deprecated form where if an identifier is not
# passed then the scoping account is updated instead. This should not
# be used in new code. Use #update_scoped_account instead.
#
# === Reference:
#
# https://api.gb1.brightbox.com/1.0/#account_update_account
#
def update_account(*args)
if args.size == 2
identifier = args[0]
options = args[1]
elsif args.size == 1
options = args[0]
else
raise ArgumentError, "wrong number of arguments (0 for 2)"
end
return nil if options.empty? || options.nil?
if identifier.nil? || identifier.empty?
Fog::Logger.deprecation("update_account() without a parameter is deprecated, use update_scoped_account instead [light_black](#{caller.first})[/]")
update_scoped_account(options)
else
request("put", "/1.0/accounts/#{identifier}", [200], options)
end
end
end
end
end
end