Module: Dnsimple::Client::Identity

Included in:
IdentityService
Defined in:
lib/dnsimple/client/identity.rb

Defined Under Namespace

Modules: StaticHelpers

Instance Method Summary collapse

Instance Method Details

#whoami(options = {}) ⇒ Dnsimple::Response<Hash>

Gets the information about the current authenticated context.

Parameters:

  • options (Hash) (defaults to: {})

Returns:

Raises:

See Also:



12
13
14
15
16
17
18
19
# File 'lib/dnsimple/client/identity.rb', line 12

def whoami(options = {})
  response = client.get(Client.versioned("/whoami"), options)

  data = response["data"]
   = data["account"] ? Struct::Account.new(data["account"]) : nil
  user = data["user"] ? Struct::User.new(data["user"]) : nil
  Response.new(response, account: , user: user)
end