dblista 0.4.0 → 0.6.2
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 +8 -1
- data/lib/dblista/list/bot.rb +1 -1
- data/lib/dblista/list/server.rb +1 -1
- data/lib/dblista/user/actions.rb +18 -0
- data/lib/dblista/user/client.rb +3 -1
- data/lib/dblista/user/info.rb +20 -0
- data/lib/dblista/user/rating.rb +35 -0
- data/lib/dblista/user/verification.rb +2 -2
- data/lib/dblista/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b31b6ae4257bc177d0ed4282e37170e4a10448e756b59d750f67f9e250e36518
|
4
|
+
data.tar.gz: 1821a94d6543ac36ec993f90252949cfe72c9511d1c9fe8a73e4fd16f56bc4db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 526fa00ddb1bdec907aa16a55c6a8dccb41600f5feca339381c5205842a2063a2dd741ea86709f58c70d92220515f8c26b3c0282c15dc0d6989409ee74a384c6
|
7
|
+
data.tar.gz: f37c6d987f425bec392883237e7c4f36a25091683523505f424a40fbdb9b4d127194f67aeaa33c2961225ad98345045d04c4fc89f9bd77423d68271158547af3
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,14 @@
|
|
2
2
|
|
3
3
|
[Dokumentacja](https://www.rubydoc.info/github/marek12306/dblista-wrapper-ruby)
|
4
4
|
|
5
|
-
Gem pozwalający na komunikację z API DBListy.
|
5
|
+
Gem pozwalający na komunikację z API DBListy.
|
6
|
+
|
7
|
+
Pozwala na:
|
8
|
+
|
9
|
+
- Automatyczne/ręczne wysyłanie statystyk
|
10
|
+
- Kontrolowanie kontem użytkownika
|
11
|
+
- Pobieranie różnych list botów oraz serwerów oraz wyszukiwanie
|
12
|
+
- Pobieranie informacji o botach, serwerach oraz użytkownikach
|
6
13
|
|
7
14
|
## Instalacja
|
8
15
|
|
data/lib/dblista/list/bot.rb
CHANGED
data/lib/dblista/list/server.rb
CHANGED
data/lib/dblista/user/actions.rb
CHANGED
@@ -58,5 +58,23 @@ module DBLista::User
|
|
58
58
|
}, @token)
|
59
59
|
true
|
60
60
|
end
|
61
|
+
|
62
|
+
# Generates token for bot
|
63
|
+
#
|
64
|
+
# @param id [Integer] bot ID
|
65
|
+
# @return [Hash] raw data from DBLista
|
66
|
+
def generate_token(id)
|
67
|
+
DBLista._validate_id id
|
68
|
+
DBLista._get("/bots/stats/#{id}?token=#{@token}")
|
69
|
+
end
|
70
|
+
|
71
|
+
# Resets token for bot
|
72
|
+
#
|
73
|
+
# @param id [Integer] bot ID
|
74
|
+
# @return [Hash] raw data from DBLista
|
75
|
+
def reset_token(id)
|
76
|
+
DBLista._validate_id id
|
77
|
+
DBLista._post("/bots/stats/#{id}/reset", nil, @token)
|
78
|
+
end
|
61
79
|
end
|
62
80
|
end
|
data/lib/dblista/user/client.rb
CHANGED
@@ -8,6 +8,7 @@ require_relative './rating'
|
|
8
8
|
require_relative './voting'
|
9
9
|
require_relative './notifications'
|
10
10
|
require_relative './verification'
|
11
|
+
require_relative './info'
|
11
12
|
|
12
13
|
# User module - client + client modules
|
13
14
|
module DBLista::User
|
@@ -27,6 +28,7 @@ module DBLista::User
|
|
27
28
|
include DBLista::User::Rating
|
28
29
|
include DBLista::User::Notifications
|
29
30
|
include DBLista::User::Verification
|
31
|
+
include DBLista::User::Information
|
30
32
|
|
31
33
|
# Allowed entity types to use
|
32
34
|
ALLOWED_TYPES = %i[bot server].freeze
|
@@ -54,7 +56,7 @@ module DBLista::User
|
|
54
56
|
# Fetches current user guilds
|
55
57
|
#
|
56
58
|
# @return [Hash] raw data from DBLista
|
57
|
-
def
|
59
|
+
def joined_guilds
|
58
60
|
@cache.get(:guilds, lifetime: DBLista::CACHE_LIFETIME) do
|
59
61
|
DBLista._get('/users/me/guilds', @token)
|
60
62
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DBLista::User
|
4
|
+
# User client - information
|
5
|
+
module Information
|
6
|
+
# Fetches your servers
|
7
|
+
#
|
8
|
+
# @return [Hash] raw data from DBLista
|
9
|
+
def servers
|
10
|
+
DBLista._get('/servers/user/me', @token)
|
11
|
+
end
|
12
|
+
|
13
|
+
# Fetches your bots
|
14
|
+
#
|
15
|
+
# @return [Hash] raw data from DBLista
|
16
|
+
def bots
|
17
|
+
DBLista._get('/bots/user/me', @token)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/dblista/user/rating.rb
CHANGED
@@ -34,5 +34,40 @@ module DBLista::User
|
|
34
34
|
DBLista._delete("/#{type}s/#{id}/rate/#{target_id}", nil, @token)
|
35
35
|
true
|
36
36
|
end
|
37
|
+
|
38
|
+
# Reports rate of a selected bot/server
|
39
|
+
#
|
40
|
+
# @param id [Integer] ID
|
41
|
+
# @param target_id [Integer] target user to remove rate from (for owners only)
|
42
|
+
# @param report_reason [String] reason of report (details)
|
43
|
+
# @param type [Symbol] type of entity (bot/server)
|
44
|
+
# @return [Boolean] true if operation succeded
|
45
|
+
def report_rate(id, rate_id, report_reason = 'Brak powodu', type = :bot)
|
46
|
+
DBLista._validate_id id
|
47
|
+
raise DBLista::Error, DBLista::Errors::TYPE_NOT_ALLOWED unless DBLista::User::Client::ALLOWED_TYPES.include?(type)
|
48
|
+
|
49
|
+
DBLista._post("/#{type}s/#{id}/ratings/#{rate_id}/report", {
|
50
|
+
reportReason: report_reason.to_s
|
51
|
+
}, @token)
|
52
|
+
true
|
53
|
+
end
|
54
|
+
|
55
|
+
# Fetches all rate reports
|
56
|
+
#
|
57
|
+
# @return [Hash] raw data from DBLista
|
58
|
+
def reports
|
59
|
+
DBLista._get('/reports')
|
60
|
+
end
|
61
|
+
|
62
|
+
# Deletes rate report
|
63
|
+
#
|
64
|
+
# @param id [Integer] report ID
|
65
|
+
# @return [Hash] raw data from DBLista
|
66
|
+
def delete_report(id, type = :bot)
|
67
|
+
raise DBLista::Error, DBLista::Errors::TYPE_NOT_ALLOWED unless DBLista::User::Client::ALLOWED_TYPES.include?(type)
|
68
|
+
|
69
|
+
DBLista._delete("/reports/#{id}", nil, @token)
|
70
|
+
true
|
71
|
+
end
|
37
72
|
end
|
38
73
|
end
|
@@ -13,7 +13,7 @@ module DBLista::User
|
|
13
13
|
def approve(id, reason = 'Brak powodu')
|
14
14
|
DBLista._validate_id id
|
15
15
|
|
16
|
-
DBLista._post("/bots/#{id}/approve?reason=#{CGI.escape reason}", nil, @token)
|
16
|
+
DBLista._post("/bots/verify/#{id}/approve?reason=#{CGI.escape reason}", nil, @token)
|
17
17
|
true
|
18
18
|
end
|
19
19
|
|
@@ -25,7 +25,7 @@ module DBLista::User
|
|
25
25
|
def reject(id, reason = 'Brak powodu')
|
26
26
|
DBLista._validate_id id
|
27
27
|
|
28
|
-
DBLista._post("/bots/#{id}/reject?reason=#{CGI.escape reason}", nil, @token)
|
28
|
+
DBLista._post("/bots/verify/#{id}/reject?reason=#{CGI.escape reason}", nil, @token)
|
29
29
|
true
|
30
30
|
end
|
31
31
|
|
data/lib/dblista/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dblista
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- deepivin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zache
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- lib/dblista/user/actions.rb
|
100
100
|
- lib/dblista/user/boosting.rb
|
101
101
|
- lib/dblista/user/client.rb
|
102
|
+
- lib/dblista/user/info.rb
|
102
103
|
- lib/dblista/user/notifications.rb
|
103
104
|
- lib/dblista/user/rating.rb
|
104
105
|
- lib/dblista/user/verification.rb
|