dbiorb 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dbio.rb +7 -0
- data/lib/dbio/search_result.rb +45 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8154ac9d42a3e4c093e23d360b473040a3e44a23a8a82054a195d313ef1718d7
|
4
|
+
data.tar.gz: 933ea43ee7dc398fbe7804ef57fa5068edbdbc2438be1e6610455e785fd9bc63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c47d939d8ab7ad86414455301f5b1244934f074b5cd79e77a2aff80223656a0fff597cbbce73004dd9182760fabe6690f2188ddfbd2efaa8d9d8f37dda6c90d
|
7
|
+
data.tar.gz: cca49f36bee87db3700dc9b1fbba38d2e326e10024e65a4729b161c8fc31d933e9ed01c7ea93ae697885cded6be3dd55de441967ab749ca9b2e01b74724f3b3f
|
data/lib/dbio.rb
CHANGED
@@ -24,6 +24,13 @@ class DBio
|
|
24
24
|
def top_upvoted
|
25
25
|
JSON.parse(RestClient.get("https://api.discord.bio/v1/topUpvoted"))['payload'].map { |e| SearchResult.new(e) }
|
26
26
|
end
|
27
|
+
|
28
|
+
# Searches for a user
|
29
|
+
# This API is not publically documented and can break at any time. Be careful!
|
30
|
+
# @return [Array<SearchResult>] the response
|
31
|
+
def search(user)
|
32
|
+
JSON.parse(RestClient.get("https://api.discord.bio/v1/user/search/#{user}"))['payload'].map { |e| SearchResult.new(e) }
|
33
|
+
end
|
27
34
|
end
|
28
35
|
|
29
36
|
# Require files.
|
data/lib/dbio/search_result.rb
CHANGED
@@ -10,6 +10,51 @@ class DBio::SearchResult
|
|
10
10
|
@data['user']['slug']
|
11
11
|
end
|
12
12
|
|
13
|
+
# @return [String] this result's discord username
|
14
|
+
def discord_username
|
15
|
+
@data['discord']['username']
|
16
|
+
end
|
17
|
+
|
18
|
+
# @return [String] this result's discord discriminator
|
19
|
+
def discord_discriminator
|
20
|
+
@data['discord']['discriminator']
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [Integer] this result's discord ID
|
24
|
+
def discord_id
|
25
|
+
@data['discord']['id'].to_i
|
26
|
+
end
|
27
|
+
|
28
|
+
# @return [String] this result's discord avatar hash
|
29
|
+
def discord_avatar
|
30
|
+
@data['discord']['avatar']
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [Boolean] if this user is verified
|
34
|
+
def verified?
|
35
|
+
@data['user']['verified'] == 1
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [Boolean] if this user is a discord.bio staff member
|
39
|
+
def staff?
|
40
|
+
@data['user']['staff']
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [Boolean] if this user is a premium user
|
44
|
+
def premium?
|
45
|
+
@data['user']['premium']
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [Integer] this user's upvotes
|
49
|
+
def upvotes
|
50
|
+
@data['user']['upvotes']
|
51
|
+
end
|
52
|
+
|
53
|
+
# @return [String] this user's description
|
54
|
+
def description
|
55
|
+
@data['user']['description']
|
56
|
+
end
|
57
|
+
|
13
58
|
# The user itself, for more detail
|
14
59
|
# @return [User] the user
|
15
60
|
def user
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbiorb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chew
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|