Module: DList::User::Boosting

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

Overview

User client - boosting

Instance Method Summary collapse

Instance Method Details

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

Boosts 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/boosting.rb', line 11

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

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

Removes boost from 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:



24
25
26
27
28
29
30
# File 'lib/dblista/user/boosting.rb', line 24

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