Class: DBio::SearchResult

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

Overview

A shorter version of a user's details

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ SearchResult

Initialize the result


4
5
6
# File 'lib/dbio/search_result.rb', line 4

def initialize(data)
  @data = data
end

Instance Method Details

#slugObject

The slug of this result's user.


9
10
11
# File 'lib/dbio/search_result.rb', line 9

def slug
  @data['user']['slug']
end

#userUser

The user itself, for more detail

Returns:

  • (User)

    the user


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

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

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