Module: DBLista::List::Bot

Defined in:
lib/dblista/list/bot.rb

Overview

Bot lists

Class Method Summary collapse

Class Method Details

.allArray

Fetches all bots

Returns:

  • (Array)

    array of raw bot data from DBLista



54
55
56
# File 'lib/dblista/list/bot.rb', line 54

def self.all
  DBLista::List::Bot.top(0, 100_000_000)
end

.premium(page = 0, limit = 10) ⇒ Hash

Fetches premium bots

Parameters:

  • page (Integer) (defaults to: 0)

    page

  • limit (Integer) (defaults to: 10)

    limit of bots per page

Returns:

  • (Hash)

    raw data from DBLista



31
32
33
34
35
# File 'lib/dblista/list/bot.rb', line 31

def self.premium(page = 0, limit = 10)
  DBLista._page_integer page
  DBLista._limit_integer limit
  DBLista._get("/bots/list/premium/#{page}?limit=#{limit}")
end

.rejectedHash

Fetches rejected bots

Returns:

  • (Hash)

    raw data from DBLista



47
48
49
# File 'lib/dblista/list/bot.rb', line 47

def self.rejected
  DBLista._get('/bots/list/rejected')
end

.search(query) ⇒ Hash

Bot search

Parameters:

  • query (String)

    query search

Returns:

  • (Hash)

    raw data from DBLista

Raises:



62
63
64
65
66
# File 'lib/dblista/list/bot.rb', line 62

def self.search(query)
  raise DBLista::Error, DBLista::Errors::QUERY_NOT_PROVIDED unless query

  DBLista._get("/bots/search/#{CGI.escape query.to_s}")
end

.top(page = 0, limit = 10) ⇒ Hash

Fetches top bots

Parameters:

  • page (Integer) (defaults to: 0)

    page

  • limit (Integer) (defaults to: 10)

    limit of bots per page

Returns:

  • (Hash)

    raw data from DBLista



20
21
22
23
24
# File 'lib/dblista/list/bot.rb', line 20

def self.top(page = 0, limit = 10)
  DBLista._page_integer page
  DBLista._limit_integer limit
  DBLista._get("/bots/list/top/#{page}?limit=#{limit}")
end

.unverifiedHash

Fetches unverified bots

Returns:

  • (Hash)

    raw data from DBLista



40
41
42
# File 'lib/dblista/list/bot.rb', line 40

def self.unverified
  DBLista._get('/bots/list/unverified')
end