class

Comrade::User

Inherits Reference < Object

Represents a user from an OAuth provider

Constructors

from_oauth_response(data : JSON::Any, mappings : Hash(String, String) | Nil = nil) : User

Create user from OAuth provider response

Source
from_workos_response(data : JSON::Any, mappings : Hash(String, String) | Nil = nil) : User

Create user from WorkOS response with enterprise-specific fields

Source
new(id : String, nickname : String | Nil = nil, name : String | Nil = nil, email : String | Nil = nil, avatar : String | Nil = nil, raw : JSON::Any = JSON::Any.new({} of String => JSON::Any))
Source

Instance methods

avatar
Source
display_name

Get display name (falls back to nickname if name is not available)

Source
email
Source
get_raw_field(field : String) : JSON::Any | Nil

Get raw field value from provider response

Source
has_avatar?

Check if user has an avatar

Source
has_email?

Check if user has an email

Source
has_name?

Check if user has a name

Source
name
Source
nickname
Source
to_h

Convert to hash

Source
to_json

Convert to JSON

Source
to_s

String representation

Source