lib/bugsnag/api/client/accounts.rb in bugsnag-api-1.0.0 vs lib/bugsnag/api/client/accounts.rb in bugsnag-api-1.0.1

- old
+ new

@@ -23,10 +23,17 @@ # @see https://bugsnag.com/docs/api/accounts#get-the-authenticated-account # @see https://bugsnag.com/docs/api/accounts#get-account-details # @example # Bugsnag::Api.account("515fb9337c1074f6fd000009") def account(account=nil, options = {}) - if account.nil? + if account.nil? || account.is_a?(Hash) + options = account || {} + + raise Bugsnag::Api::AccountCredentialsRequired.new( + "Fetching account without an id is only possible when using "\ + "an account auth token." + ) unless token_authenticated? + get "account", options else get "accounts/#{account}", options end end