Module: DList::User::Rating
- Included in:
- Client
- Defined in:
- lib/dblista/user/rating.rb
Overview
User client - rating
Instance Method Summary collapse
-
#delete_rate(id, target_id = nil, type = :bot) ⇒ Boolean
Removes rate for a selected bot/server.
-
#delete_report(id, type = :bot) ⇒ Hash
Deletes rate report.
-
#rate(id, rating, details, type = :bot) ⇒ Boolean
Sends rate for a selected bot/server.
-
#report_rate(id, rate_id, report_reason = 'Brak powodu', type = :bot) ⇒ Boolean
Reports rate of a selected bot/server.
-
#reports ⇒ Hash
Fetches all rate reports.
Instance Method Details
#delete_rate(id, target_id = nil, type = :bot) ⇒ Boolean
Removes rate for a selected bot/server
30 31 32 33 34 35 36 |
# File 'lib/dblista/user/rating.rb', line 30 def delete_rate(id, target_id = nil, type = :bot) DList._validate_id id raise DList::Error, DList::Errors::TYPE_NOT_ALLOWED unless DList::User::Client::ALLOWED_TYPES.include?(type) DList._delete("/#{type}s/#{id}/rate/#{target_id}", nil, @token) true end |
#delete_report(id, type = :bot) ⇒ Hash
Deletes rate report
66 67 68 69 70 71 |
# File 'lib/dblista/user/rating.rb', line 66 def delete_report(id, type = :bot) raise DList::Error, DList::Errors::TYPE_NOT_ALLOWED unless DList::User::Client::ALLOWED_TYPES.include?(type) DList._delete("/reports/#{id}", nil, @token) true end |
#rate(id, rating, details, type = :bot) ⇒ Boolean
Sends rate for a selected bot/server
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dblista/user/rating.rb', line 13 def rate(id, , details, type = :bot) DList._validate_id id raise DList::Error, DList::Errors::TYPE_NOT_ALLOWED unless DList::User::Client::ALLOWED_TYPES.include?(type) DList._post("/#{type}s/#{id}/rate", { rating: , details: details }, @token) true end |
#report_rate(id, rate_id, report_reason = 'Brak powodu', type = :bot) ⇒ Boolean
Reports rate of a selected bot/server
45 46 47 48 49 50 51 52 53 |
# File 'lib/dblista/user/rating.rb', line 45 def report_rate(id, rate_id, report_reason = 'Brak powodu', type = :bot) DList._validate_id id raise DList::Error, DList::Errors::TYPE_NOT_ALLOWED unless DList::User::Client::ALLOWED_TYPES.include?(type) DList._post("/#{type}s/#{id}/ratings/#{rate_id}/report", { reportReason: report_reason.to_s }, @token) true end |
#reports ⇒ Hash
Fetches all rate reports
58 59 60 |
# File 'lib/dblista/user/rating.rb', line 58 def reports DList._get('/reports') end |