class DBio::User
Find information about users.
Attributes
@return data in raw json form.
@return data in raw json form.
Public Class Methods
Initialize the user
# File lib/dbio/user.rb, line 4 def initialize(data) @user = data['user']['details'] @discord = data['discord'] @discord_connections = data['user']['discordConnections'] @user_connections = data['user']['user_connections'] end
Public Instance Methods
@return [Date, nil] the birthdate of this user, if one is set
# File lib/dbio/user.rb, line 90 def birthday Date.parse(@user['birthday']) end
@return [Time] The time this user was created
# File lib/dbio/user.rb, line 58 def created Time.parse(@user['created_at']) end
@return [String, nil] the description for this user, if one is set.
# File lib/dbio/user.rb, line 63 def description @user['description'] end
This is the user's Discord connections as they appear on their Discord profile @return [Array<DiscordConnection>] the user's discord connections
# File lib/dbio/user.rb, line 129 def discord_connections @discord_connections.map { |e| DBio::DiscordConnection.new(e) } end
The user's Discord profile information, not overly specific either. I instead recommend just getting it though your Discord Library with the ID @see [User#id]
# File lib/dbio/user.rb, line 142 def discord_profile DBio::DiscordProfile.new(@discord) end
@return [String, nil] the user's email, if one is set
# File lib/dbio/user.rb, line 95 def email @user['email'] end
The oauth flags for this user. Not useful on their own. @see DBio::DiscordProfile#public_flags
@return [Integer] the flags for this user
# File lib/dbio/user.rb, line 48 def flags @user['flags'] end
The API returns an integer, so this is converted to a String. @return [String, nil] the gender of this user in String form.
# File lib/dbio/user.rb, line 74 def gender case @user['gender'] when 0 "Male" when 1 "Female" when 2 "Non-Binary" when nil "Undisclosed" else nil end end
The id of the user. @return [Integer] User
ID in integer form.
# File lib/dbio/user.rb, line 31 def id @user['user_id'].to_i end
@return [Integer] the amount of likes this user has.
# File lib/dbio/user.rb, line 36 def likes @user['likes'] end
@return [String, nil] the location for this user, if one is set.
# File lib/dbio/user.rb, line 68 def location @user['location'] end
@return [String, nil] the user's occupation, if one is set
# File lib/dbio/user.rb, line 100 def occupation @user['occupation'] end
The link to this user's profile @return [String] this user's profile
# File lib/dbio/user.rb, line 25 def profile_url "https://dsc.bio/#{slug}" end
The slug of this user. Use: dsc.bio/slug @see User#profile_url
@return [String] the slug
# File lib/dbio/user.rb, line 19 def slug @user['slug'] end
@return [Boolean] the user's staff status
# File lib/dbio/user.rb, line 115 def staff? @user['staff'] end
The user's Discord.Bio connections. Not as specific. @return [Array<UserConnection>] the user's discord.bio connections
# File lib/dbio/user.rb, line 135 def user_connections @user_connections.map { |e, f| DBio::UserConnection.new({ "type": e, "name": f }) } end
@return [boolean] if this user is verified
# File lib/dbio/user.rb, line 53 def verified? @user['verified'] end