Class: DBio

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

Overview

All DBio functionality, whether extended or just here.

Defined Under Namespace

Classes: DiscordConnection, DiscordProfile, SearchResult, User, UserConnection

Instance Method Summary collapse

Constructor Details

#initializeDBio

Initialize the API. Not much here really.


8
# File 'lib/dbio.rb', line 8

def initialize; end

Instance Method Details

#top_upvotedArray<SearchResult>

Returns the top upvoted users. Their data is short, so it's not really worth storing a lot of data

Returns:

See Also:

  • DBio.[SearchResult[SearchResult#user]

24
25
26
# File 'lib/dbio.rb', line 24

def top_upvoted
  JSON.parse(RestClient.get("https://api.discord.bio/v1/topUpvoted"))['payload'].map { |e| SearchResult.new(e) }
end

#user(id) ⇒ User

Load a user

Parameters:

  • id (Integer, String)

    the user ID or name of the requested user.

Returns:

  • (User)

    the new user object

Raises:

  • (RestClient::NotFound)

    if the specified user does not exist


14
15
16
17
18
# File 'lib/dbio.rb', line 14

def user(id)
  user = JSON.parse(RestClient.get("https://api.discord.bio/v1/user/details/#{id}"))

  User.new(user['payload'])
end