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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: adb8d6a712f4d76ef0f5baf5d8061d0940e5651c21947ceee764f436f300b096
4
- data.tar.gz: 8ed87a06a991cd35ad624825d02c2e09688f7cdb297513edfd75efe61f8006ab
3
+ metadata.gz: 8154ac9d42a3e4c093e23d360b473040a3e44a23a8a82054a195d313ef1718d7
4
+ data.tar.gz: 933ea43ee7dc398fbe7804ef57fa5068edbdbc2438be1e6610455e785fd9bc63
5
5
  SHA512:
6
- metadata.gz: 3bc0d6a45d6d20b108e96a1ee9cce0bf70de322d40a0f222fefbcea70351a180298893277a6ac5c57f23bb07ed62962286d396c7d9b7a6d6a43b49d6266cc4c9
7
- data.tar.gz: ed8a3de45499cd7f87398574150f99e4763c4e8a3b1ecae386d74b1f5804792fac3ae47ade3d7e1822e5485db64982c95966eb86cacc0fef4c9492bbed7fa631
6
+ metadata.gz: 6c47d939d8ab7ad86414455301f5b1244934f074b5cd79e77a2aff80223656a0fff597cbbce73004dd9182760fabe6690f2188ddfbd2efaa8d9d8f37dda6c90d
7
+ data.tar.gz: cca49f36bee87db3700dc9b1fbba38d2e326e10024e65a4729b161c8fc31d933e9ed01c7ea93ae697885cded6be3dd55de441967ab749ca9b2e01b74724f3b3f
@@ -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.
@@ -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.1.2
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-13 00:00:00.000000000 Z
11
+ date: 2020-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json