dblista 0.4.1 → 0.5.0
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/user/actions.rb +8 -0
- data/lib/dblista/user/client.rb +2 -0
- data/lib/dblista/user/info.rb +19 -0
- data/lib/dblista/user/rating.rb +32 -1
- data/lib/dblista/user/verification.rb +2 -2
- data/lib/dblista/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c39d8fe14ad93cfc84137e860ecb152039179ff8f72621e2b1ebc0ae0bc72b12
|
4
|
+
data.tar.gz: a20e7197c4ac2bc5dc92aab67a64c1df1770094c319375922e9b8716c6c333d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f38b5ed0959c732dec05bcc85a2f74790ad42d3999659ed9bc5a49d25a8846b223864207bea327ede6151037fab857759c3ab10021ee34b102a348c3e12ae553
|
7
|
+
data.tar.gz: c5214e909e8a5e962d770357cd0084803ef945b0a0b3a22617d8463f275035298a701a85772e9f9ebb741a08f85d0c094f16ce678160c86361e1857598fda0ad
|
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/user/actions.rb
CHANGED
@@ -58,5 +58,13 @@ module DBLista::User
|
|
58
58
|
}, @token)
|
59
59
|
true
|
60
60
|
end
|
61
|
+
# Generates token for bot
|
62
|
+
#
|
63
|
+
# @param id [Integer] bot ID
|
64
|
+
# @return [Hash] raw data from DBLista
|
65
|
+
def generate_token(id)
|
66
|
+
DBLista._validate_id id
|
67
|
+
DBLista._get("/bots/stats/#{id}?token=#{@token}")
|
68
|
+
end
|
61
69
|
end
|
62
70
|
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
|
@@ -0,0 +1,19 @@
|
|
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", nil, @token)
|
11
|
+
end
|
12
|
+
# Fetches your bots
|
13
|
+
#
|
14
|
+
# @return [Hash] raw data from DBLista
|
15
|
+
def bots
|
16
|
+
DBLista._get("/bots/user/me", nil, @token)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/dblista/user/rating.rb
CHANGED
@@ -20,7 +20,6 @@ module DBLista::User
|
|
20
20
|
}, @token)
|
21
21
|
true
|
22
22
|
end
|
23
|
-
|
24
23
|
# Removes rate for a selected bot/server
|
25
24
|
#
|
26
25
|
# @param id [Integer] entity ID
|
@@ -34,5 +33,37 @@ module DBLista::User
|
|
34
33
|
DBLista._delete("/#{type}s/#{id}/rate/#{target_id}", nil, @token)
|
35
34
|
true
|
36
35
|
end
|
36
|
+
# Reports rate of a selected bot/server
|
37
|
+
#
|
38
|
+
# @param id [Integer] ID
|
39
|
+
# @param target_id [Integer] target user to remove rate from (for owners only)
|
40
|
+
# @param report_reason [String] reason of report (details)
|
41
|
+
# @param type [Symbol] type of entity (bot/server)
|
42
|
+
# @return [Boolean] true if operation succeded
|
43
|
+
def report_rate(id, rate_id, report_reason = 'Brak powodu', type = :bot)
|
44
|
+
DBLista._validate_id id
|
45
|
+
raise DBLista::Error, DBLista::Errors::TYPE_NOT_ALLOWED unless DBLista::User::Client::ALLOWED_TYPES.include?(type)
|
46
|
+
|
47
|
+
DBLista._post("/#{type}s/#{id}/ratings/#{rate_id}/report", {
|
48
|
+
reportReason: report_reason.to_s
|
49
|
+
}, @token)
|
50
|
+
true
|
51
|
+
end
|
52
|
+
# Fetches all rate reports
|
53
|
+
#
|
54
|
+
# @return [Hash] raw data from DBLista
|
55
|
+
def reports
|
56
|
+
DBLista._get('/reports')
|
57
|
+
end
|
58
|
+
# Deletes rate report
|
59
|
+
#
|
60
|
+
# @param id [Integer] report ID
|
61
|
+
# @return [Hash] raw data from DBLista
|
62
|
+
def delete_report(id, type = :bot)
|
63
|
+
raise DBLista::Error, DBLista::Errors::TYPE_NOT_ALLOWED unless DBLista::User::Client::ALLOWED_TYPES.include?(type)
|
64
|
+
|
65
|
+
DBLista._delete("/reports/#{id}", nil, @token)
|
66
|
+
true
|
67
|
+
end
|
37
68
|
end
|
38
69
|
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,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dblista
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- deepivin
|
@@ -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
|