dblruby 1.1.1 → 1.1.2.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
  SHA1:
3
- metadata.gz: fe765e1fc7fa9e5b842c5b5841e68e0795bae6ec
4
- data.tar.gz: 6bb3509bb5defa03e95b25138bacf5b468403488
3
+ metadata.gz: 5c5999cc00c3c7162f7849599e3a99b821d709da
4
+ data.tar.gz: de700d1d0750d5e4f2a95bc8713c1d4b3e5ce57e
5
5
  SHA512:
6
- metadata.gz: 81e1492d1df394f9fa7210f42eb445f3470bdf10e6b86f749534c579100256935ed3260cba61f4b6b5309383cf9d50de5f9c93192f895b8bfea6a0c19388d3f9
7
- data.tar.gz: e09cca4fdaff2d8dccd05d04c3aa0b12245e299ef8919f9be3863698a44f10dd2531552cf037b0e0912cbc3440ab8331c86742d11aec80bac0e15c7ee1d27c88
6
+ metadata.gz: e4ef2ac616b2876c83c38144b3b5c9db29999afda110c714db86b2bbbdfeee9bb0a5e9ae73337f78d7c6626b559592b57868d6488a73397139e783b5e2ec05e8
7
+ data.tar.gz: 032a8ea56f467a279a99289b7ac6510fe1b5dea3b540f0c192fa58193d8b472c5ad1a2659fe9e1d5400d06dcb7eb6b99903639ef9beeb50db8493d60c04a8b73
@@ -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
@@ -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,
@@ -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?'
@@ -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-14 00:00:00.000000000 Z
11
+ date: 2018-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json