dbiorb 0.1.0 → 0.1.1

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: 4b597f780c1f5b1c9487454604b48a13b6529c40670657afe01b6bab173ea340
4
- data.tar.gz: 558a0217c77fcbbdfa1d281c9e4a3e7655224bbfdf23f4ec91372b98703457d0
3
+ metadata.gz: 1fc93ac9fc1e4a99dd8f3ee921bf47a8ab9c80acb2826ad75b9c01982bd68fbc
4
+ data.tar.gz: 2c8c500a671a4b17b03a69544307e6735722e37999ecaa31bceab435631ffe1b
5
5
  SHA512:
6
- metadata.gz: ba80a4298056afa7a89895f98fabf3235c6e5c72dead03a2d727373de66cdf4c52bfcc8b91e843e7c43cd2e183609e51ed81b9659f49ff25293e476a92573282
7
- data.tar.gz: 7487b13123c5ae98c9a7540ccbbe2da85edfa1fd5bb94ede7eb0aaf0d1c474541a0c914501e8c2ce662162e6e00bf6cc752e2da841727ad68436e7375819fbe1
6
+ metadata.gz: e636b2cbe0d4916da8db6240c8dc89beeaf413f2bf9fdd40b3d3c53c0abedb03309c44dc739c13cc1fd196e573792d779febe6da34bb9ecb5265d5fc10f2d10a
7
+ data.tar.gz: 03d7850c5258d270acafb11a9b601f34c1828e00b09ac8866182521f83e474df1cf9fbd965c77b46d231534908273589bb58dd5484c6dad66c29b811f4f093fe
@@ -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'
@@ -5,14 +5,16 @@ class DBio::SearchResult
5
5
  @data = data
6
6
  end
7
7
 
8
- # The type of connection, e.g. Twitter, YouTube, etc.
9
- # @return [String] the type of connection
10
- def type
11
- @data['type']
8
+ # The slug of this result's user.
9
+ def slug
10
+ @data['user']['slug']
12
11
  end
13
12
 
14
- # @return [String] the name as it appears on the User profile
15
- def name
16
- @data['name']
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
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbiorb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chew