dblista 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/dblista.rb +7 -0
- data/lib/dblista/errors.rb +2 -0
- data/lib/dblista/list/bot.rb +9 -14
- data/lib/dblista/list/server.rb +9 -14
- data/lib/dblista/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af5c06a56c095575ded742823dfeb531103e6746113c81a0c9a2e14081dd6d78
|
4
|
+
data.tar.gz: 2ed0b2d32d232b0e5d51bc5f78488762ace9fda84de2d551aead67033fb25d54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ec8859f47192634b82352e48fb3198e32e5b1ee275c952844a8a1e2162393b098cfbf2e3f4ed5417b6a0442b8e1de88e73f367ae27cf023d5e6f57a9665dfa0
|
7
|
+
data.tar.gz: 59e82924a1a5ebf293e62af219773ab5ddce35d72eb7f06258b1c0e8b01cc09ed9f25771a642f13dcbf9d07d991005a92b8ced9e72cd4bc5c3fd9fe938bcf94b
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/dblista.rb
CHANGED
@@ -78,4 +78,11 @@ module DBLista
|
|
78
78
|
def self._page_integer(input)
|
79
79
|
raise DBLista::Error, DBLista::Errors::PAGE_INTEGER unless input.is_a?(Integer)
|
80
80
|
end
|
81
|
+
|
82
|
+
# @!visibility private
|
83
|
+
def self._limit_integer(input)
|
84
|
+
puts input
|
85
|
+
puts input.is_a?(Integer)
|
86
|
+
raise DBLista::Error, DBLista::Errors::LIMIT_INTEGER unless input.is_a?(Integer)
|
87
|
+
end
|
81
88
|
end
|
data/lib/dblista/errors.rb
CHANGED
@@ -8,6 +8,8 @@ module DBLista::Errors
|
|
8
8
|
PAGE_INTEGER = 'Page must be an integer'
|
9
9
|
# Raised when rank is not an integer
|
10
10
|
RANK_INTEGER = 'Rank must be an integer'
|
11
|
+
# Raised when provided limit is not an integer
|
12
|
+
LIMIT_INTEGER = 'Limit must be an integer'
|
11
13
|
# Raised when token is not provided
|
12
14
|
TOKEN_NOT_PROVIDED = 'Token is not provided'
|
13
15
|
# Raised when type symbol is invalid
|
data/lib/dblista/list/bot.rb
CHANGED
@@ -15,19 +15,23 @@ module DBLista::List
|
|
15
15
|
# Fetches top bots
|
16
16
|
#
|
17
17
|
# @param page [Integer] page
|
18
|
+
# @param limit [Integer] limit of bots per page
|
18
19
|
# @return [Hash] raw data from DBLista
|
19
|
-
def self.top(page = 0)
|
20
|
+
def self.top(page = 0, limit = 10)
|
20
21
|
DBLista._page_integer page
|
21
|
-
DBLista.
|
22
|
+
DBLista._limit_integer limit
|
23
|
+
DBLista._get("/bots/list/top/#{page}?limit=#{limit}")
|
22
24
|
end
|
23
25
|
|
24
26
|
# Fetches premium bots
|
25
27
|
#
|
26
28
|
# @param page [Integer] page
|
29
|
+
# @param limit [Integer] limit of bots per page
|
27
30
|
# @return [Hash] raw data from DBLista
|
28
|
-
def self.premium(page = 0)
|
31
|
+
def self.premium(page = 0, limit = 10)
|
29
32
|
DBLista._page_integer page
|
30
|
-
DBLista.
|
33
|
+
DBLista._limit_integer limit
|
34
|
+
DBLista._get("/bots/list/premium/#{page}?limit=#{limit}")
|
31
35
|
end
|
32
36
|
|
33
37
|
# Fetches unverified bots
|
@@ -48,16 +52,7 @@ module DBLista::List
|
|
48
52
|
#
|
49
53
|
# @return [Array] array of raw bot data from DBLista
|
50
54
|
def self.all
|
51
|
-
|
52
|
-
i = 0
|
53
|
-
loop do
|
54
|
-
page = DBLista::List::Bot.top(i)
|
55
|
-
break if page.length.zero?
|
56
|
-
|
57
|
-
bots += page
|
58
|
-
i += 1
|
59
|
-
end
|
60
|
-
bots
|
55
|
+
DBLista::List::Bot.top(0, 100_000_000)
|
61
56
|
end
|
62
57
|
|
63
58
|
# Bot search
|
data/lib/dblista/list/server.rb
CHANGED
@@ -8,35 +8,30 @@ module DBLista::List
|
|
8
8
|
# Fetches top servers
|
9
9
|
#
|
10
10
|
# @param page [Integer] page
|
11
|
+
# @param limit [Integer] limit of servers per page
|
11
12
|
# @return [Hash] raw data from DBLista
|
12
|
-
def self.top(page = 0)
|
13
|
+
def self.top(page = 0, limit = 10)
|
13
14
|
DBLista._page_integer page
|
14
|
-
DBLista.
|
15
|
+
DBLista._limit_integer limit
|
16
|
+
DBLista._get("/servers/list/top/#{page}?limit=#{limit}")
|
15
17
|
end
|
16
18
|
|
17
19
|
# Fetches premium servers
|
18
20
|
#
|
19
21
|
# @param page [Integer] page
|
22
|
+
# @param limit [Integer] limit of servers per page
|
20
23
|
# @return [Hash] raw data from DBLista
|
21
|
-
def self.premium(page = 0)
|
24
|
+
def self.premium(page = 0, limit = 10)
|
22
25
|
DBLista._page_integer page
|
23
|
-
DBLista.
|
26
|
+
DBLista._limit_integer limit
|
27
|
+
DBLista._get("/servers/list/premium/#{page}?limit=#{limit}")
|
24
28
|
end
|
25
29
|
|
26
30
|
# Fetches all servers
|
27
31
|
#
|
28
32
|
# @return [Array] array of raw server data from DBLista
|
29
33
|
def self.all
|
30
|
-
|
31
|
-
i = 0
|
32
|
-
loop do
|
33
|
-
page = DBLista::List::Server.top(i)
|
34
|
-
break if page.length.zero?
|
35
|
-
|
36
|
-
servers += page
|
37
|
-
i += 1
|
38
|
-
end
|
39
|
-
servers
|
34
|
+
DBLista::List::Server.top(0, 100_000_000)
|
40
35
|
end
|
41
36
|
|
42
37
|
# Server search
|
data/lib/dblista/version.rb
CHANGED