Module: DList::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 DList



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

def self.all
  DList._cache(:botsall) do
    DList._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 DList



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

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

.rejectedHash

Fetches rejected bots

Returns:

  • (Hash)

    raw data from DList



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

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

.search(query) ⇒ Hash

Bot search

Parameters:

  • query (String)

    query search

Returns:

  • (Hash)

    raw data from DList

Raises:



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

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

  DList._cache("botsearch#{query}") do
    DList._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 DList



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

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

.unverifiedHash

Fetches unverified bots

Returns:

  • (Hash)

    raw data from DList



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

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