dbiorb 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/dbio.rb +6 -1
- data/lib/dbio/search_result.rb +9 -7
- data/lib/dbio/user.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fc93ac9fc1e4a99dd8f3ee921bf47a8ab9c80acb2826ad75b9c01982bd68fbc
|
4
|
+
data.tar.gz: 2c8c500a671a4b17b03a69544307e6735722e37999ecaa31bceab435631ffe1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e636b2cbe0d4916da8db6240c8dc89beeaf413f2bf9fdd40b3d3c53c0abedb03309c44dc739c13cc1fd196e573792d779febe6da34bb9ecb5265d5fc10f2d10a
|
7
|
+
data.tar.gz: 03d7850c5258d270acafb11a9b601f34c1828e00b09ac8866182521f83e474df1cf9fbd965c77b46d231534908273589bb58dd5484c6dad66c29b811f4f093fe
|
data/lib/dbio.rb
CHANGED
@@ -17,13 +17,18 @@ class DBio
|
|
17
17
|
User.new(user['payload'])
|
18
18
|
end
|
19
19
|
|
20
|
+
# Returns the top upvoted users.
|
21
|
+
# Their data is short, so it's not really worth storing a lot of data
|
22
|
+
# @see [SearchResult#user]
|
23
|
+
# @return [Array<SearchResult>] the response
|
20
24
|
def top_upvoted
|
21
|
-
|
25
|
+
JSON.parse(RestClient.get("https://api.discord.bio/v1/topUpvoted"))['payload'].map { |e| SearchResult.new(e) }
|
22
26
|
end
|
23
27
|
end
|
24
28
|
|
25
29
|
# Require files.
|
26
30
|
require 'dbio/discord_connection'
|
27
31
|
require 'dbio/discord_profile'
|
32
|
+
require 'dbio/search_result'
|
28
33
|
require 'dbio/user_connection'
|
29
34
|
require 'dbio/user'
|
data/lib/dbio/search_result.rb
CHANGED
@@ -5,14 +5,16 @@ class DBio::SearchResult
|
|
5
5
|
@data = data
|
6
6
|
end
|
7
7
|
|
8
|
-
# The
|
9
|
-
|
10
|
-
|
11
|
-
@data['type']
|
8
|
+
# The slug of this result's user.
|
9
|
+
def slug
|
10
|
+
@data['user']['slug']
|
12
11
|
end
|
13
12
|
|
14
|
-
#
|
15
|
-
|
16
|
-
|
13
|
+
# The user itself, for more detail
|
14
|
+
# @return [User] the user
|
15
|
+
def user
|
16
|
+
user = JSON.parse(RestClient.get("https://api.discord.bio/v1/user/details/#{slug}"))
|
17
|
+
|
18
|
+
DBio::User.new(user['payload'])
|
17
19
|
end
|
18
20
|
end
|
data/lib/dbio/user.rb
CHANGED
@@ -26,6 +26,11 @@ class DBio::User
|
|
26
26
|
@user['user_id'].to_i
|
27
27
|
end
|
28
28
|
|
29
|
+
# @return [Integer] the amount of upvotes this user has.
|
30
|
+
def upvotes
|
31
|
+
@user['upvotes']
|
32
|
+
end
|
33
|
+
|
29
34
|
# The flags for this user. Not entirely sure what they mean, but they're there.
|
30
35
|
# @return [Integer] the flags for this user
|
31
36
|
def flags
|