Class: VersSdk::WhoamiResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/vers_sdk/models.rb

Overview

Response body for ‘GET /api/v1/whoami`. Identifies the principal (user + organization) behind the bearer token used for the request, plus minimal metadata about the API key itself. The endpoint is read-only and requires only a valid API key — useful for answering questions like ’whose account does this key belong to?‘ without needing direct database access. Modeled after GitHub’s ‘GET /user`.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_json(json_str) ⇒ Object



1482
1483
1484
1485
# File 'lib/vers_sdk/models.rb', line 1482

def self.from_json(json_str)
  obj = json_str.is_a?(String) ? JSON.parse(json_str) : json_str
  new(obj)
end

Instance Method Details

#to_hObject



1487
1488
1489
1490
1491
1492
1493
# File 'lib/vers_sdk/models.rb', line 1487

def to_h
  {
    "api_key" => @whoami_response,
    "org" => @whoami_response,
    "user" => @whoami_response,
  }
end

#to_json(*args) ⇒ Object



1495
1496
1497
# File 'lib/vers_sdk/models.rb', line 1495

def to_json(*args)
  to_h.to_json(*args)
end