Module: DList::User::Voting

Included in:
Client
Defined in:
lib/dblista/user/voting.rb

Overview

User client - voting

Instance Method Summary collapse

Instance Method Details

#vote(id, type = :bot) ⇒ Boolean

Votes for a selected bot/server

Parameters:

  • id (Integer)

    entity ID

  • type (Symbol) (defaults to: :bot)

    type of entity (bot/server)

Returns:

  • (Boolean)

    true if operation succeded

Raises:



11
12
13
14
15
16
17
# File 'lib/dblista/user/voting.rb', line 11

def vote(id, 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}/vote", nil, @token)
  true
end