class DList::User::Client
DList
user client
@example Server voting
client = DList::User::Client.new "USER_TOKEN" client.vote(123456789012345678, :server)
@example Bot rating
client = DList::User::Client.new "USER_TOKEN" client.rate(123456789012345678, 5, 'Nice bot')
Constants
- ALLOWED_TYPES
Allowed entity types to use
Attributes
token[RW]
Public Class Methods
new(token)
click to toggle source
# File lib/dblista/user/client.rb, line 38 def initialize(token) raise DList::Error, DList::Errors::TOKEN_NOT_PROVIDED unless token @token = token @cache = Zache.new me end
Public Instance Methods
joined_guilds()
click to toggle source
Fetches current user guilds
@return [Hash] raw data from DList
# File lib/dblista/user/client.rb, line 59 def joined_guilds @cache.get(:guilds, lifetime: DList::CACHE_LIFETIME) do DList._get('/users/me/guilds', @token) end end
me()
click to toggle source
Fetches information about current user
@return [Hash] raw data from DList
# File lib/dblista/user/client.rb, line 50 def me @cache.get(:guilds, lifetime: DList::CACHE_LIFETIME) do DList._get('/users/me', @token) end end