dblruby 1.1.1 → 1.1.2.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/dblruby.rb +2 -2
- data/lib/dblruby/bot.rb +2 -2
- data/lib/dblruby/stats.rb +1 -1
- data/lib/dblruby/user.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c5999cc00c3c7162f7849599e3a99b821d709da
|
4
|
+
data.tar.gz: de700d1d0750d5e4f2a95bc8713c1d4b3e5ce57e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4ef2ac616b2876c83c38144b3b5c9db29999afda110c714db86b2bbbdfeee9bb0a5e9ae73337f78d7c6626b559592b57868d6488a73397139e783b5e2ec05e8
|
7
|
+
data.tar.gz: 032a8ea56f467a279a99289b7ac6510fe1b5dea3b540f0c192fa58193d8b472c5ad1a2659fe9e1d5400d06dcb7eb6b99903639ef9beeb50db8493d60c04a8b73
|
data/lib/dblruby.rb
CHANGED
@@ -20,7 +20,7 @@ class DBLRuby
|
|
20
20
|
# Load a bot.
|
21
21
|
# @param id [Integer, String] Integer/String ID of the bot you're requesting.
|
22
22
|
def bot(id)
|
23
|
-
Bot.new(id: id)
|
23
|
+
Bot.new(id: id, api: @api)
|
24
24
|
end
|
25
25
|
|
26
26
|
alias_method :loadbot, :bot
|
@@ -34,7 +34,7 @@ class DBLRuby
|
|
34
34
|
# Load a user
|
35
35
|
# @param id [Integer, String] Integer/String ID of the user you're requesting.
|
36
36
|
def user(id)
|
37
|
-
User.new(id)
|
37
|
+
User.new(id, api)
|
38
38
|
end
|
39
39
|
|
40
40
|
alias_method :loaduser, :user
|
data/lib/dblruby/bot.rb
CHANGED
@@ -3,12 +3,12 @@ class DBLRuby::Bot
|
|
3
3
|
# Initialize the bot
|
4
4
|
# @param id [Integer, String] Integer/String ID of bot you're requesting.
|
5
5
|
# @raise [DBLRuby::Errors::InvalidBot] if the DBL returns a 404 error.
|
6
|
-
def initialize(id: nil, data: nil)
|
6
|
+
def initialize(id: nil, data: nil, api: nil)
|
7
7
|
if id.nil?
|
8
8
|
@data = data
|
9
9
|
else
|
10
10
|
url = "https://discordbots.org/api/bots/#{id}"
|
11
|
-
@data = JSON.parse(RestClient.get(url))
|
11
|
+
@data = JSON.parse(RestClient.get(url, Authorization: api))
|
12
12
|
end
|
13
13
|
rescue RestClient::NotFound
|
14
14
|
raise DBLRuby::Errors::InvalidBot,
|
data/lib/dblruby/stats.rb
CHANGED
@@ -12,7 +12,7 @@ class DBLRuby::Stats
|
|
12
12
|
# @raise [DBLRuby::Errors::InvalidID] if the DBL returns a 404 error.
|
13
13
|
def servercount
|
14
14
|
url = "https://discordbots.org/api/bots/#{@id}"
|
15
|
-
JSON.parse(RestClient.get(url))['server_count'].to_i
|
15
|
+
JSON.parse(RestClient.get(url, Authorization: @api))['server_count'].to_i
|
16
16
|
rescue RestClient::NotFound
|
17
17
|
raise DBLRuby::Errors::InvalidID,
|
18
18
|
'DBL Returned a 404 unknown error! Did you enter the correct ID?'
|
data/lib/dblruby/user.rb
CHANGED
@@ -3,9 +3,9 @@ class DBLRuby::User
|
|
3
3
|
# Initialize the user
|
4
4
|
# @param id [Integer, String] Integer/String ID of user you're requesting.
|
5
5
|
# @raise [DBLRuby::Errors::InvalidUser] if the DBL returns a 404 error.
|
6
|
-
def initialize(id)
|
6
|
+
def initialize(id, api)
|
7
7
|
url = "https://discordbots.org/api/users/#{id}"
|
8
|
-
@data = JSON.parse(RestClient.get(url))
|
8
|
+
@data = JSON.parse(RestClient.get(url, Authorization: api))
|
9
9
|
rescue RestClient::NotFound
|
10
10
|
raise DBLRuby::Errors::InvalidUser,
|
11
11
|
'The API returned a 404 error! Does that user exist?'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dblruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.1
|
4
|
+
version: 1.1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chewsterchew
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|