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



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

def self.all
  DBLista._cache(:botsall) do
    DBLista._get('/bots/list/top/0?limit=1000000')
  end
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



33
34
35
36
37
38
39
# File 'lib/dblista/list/bot.rb', line 33

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

.rejectedHash

Fetches rejected bots

Returns:

  • (Hash)

    raw data from DBLista



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

def self.rejected
  DBLista._cache(:botsrejected) do
    DBLista._get('/bots/list/rejected')
  end
end

.search(query) ⇒ Hash

Bot search

Parameters:

  • query (String)

    query search

Returns:

  • (Hash)

    raw data from DBLista

Raises:



72
73
74
75
76
77
78
# File 'lib/dblista/list/bot.rb', line 72

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

  DBLista._cache("botsearch#{query}") do
    DBLista._get("/bots/search/#{CGI.escape query.to_s}")
  end
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
25
26
# File 'lib/dblista/list/bot.rb', line 20

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

.unverifiedHash

Fetches unverified bots

Returns:

  • (Hash)

    raw data from DBLista



44
45
46
47
48
# File 'lib/dblista/list/bot.rb', line 44

def self.unverified
  DBLista._cache(:botsunverified) do
    DBLista._get('/bots/list/unverified')
  end
end