Module: DBLista::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)
  DBLista._validate_id id
  raise DBLista::Error, DBLista::Errors::TYPE_NOT_ALLOWED unless DBLista::User::Client::ALLOWED_TYPES.include?(type)

  DBLista._post("/#{type}s/#{id}/vote", nil, @token)
  true
end