Module: DList::List::Server
- Defined in:
- lib/dblista/list/server.rb
Overview
Server lists
Class Method Summary collapse
-
.all ⇒ Array
Fetches all servers.
-
.premium(page = 0, limit = 10) ⇒ Hash
Fetches premium servers.
-
.search(query) ⇒ Hash
Server search.
-
.top(page = 0, limit = 10) ⇒ Hash
Fetches top servers.
Class Method Details
.all ⇒ Array
Fetches all servers
37 38 39 40 41 |
# File 'lib/dblista/list/server.rb', line 37 def self.all DList._cache(:serversall) do DList._get('/servers/list/top/0?limit=1000000') end end |
.premium(page = 0, limit = 10) ⇒ Hash
Fetches premium servers
26 27 28 29 30 31 32 |
# File 'lib/dblista/list/server.rb', line 26 def self.premium(page = 0, limit = 10) DList._page_integer page DList._limit_integer limit DList._cache("serverspremium#{page}-#{limit}") do DList._get("/servers/list/premium/#{page}?limit=#{limit}") end end |
.search(query) ⇒ Hash
Server search
47 48 49 50 51 52 53 |
# File 'lib/dblista/list/server.rb', line 47 def self.search(query) raise DList::Error, DList::Errors::QUERY_NOT_PROVIDED unless query DList._cache("serversearch#{query}") do DList._get("/servers/search/#{CGI.escape query.to_s}") end end |
.top(page = 0, limit = 10) ⇒ Hash
Fetches top servers
13 14 15 16 17 18 19 |
# File 'lib/dblista/list/server.rb', line 13 def self.top(page = 0, limit = 10) DList._page_integer page DList._limit_integer limit DList._cache("serverstop#{page}-#{limit}") do DList._get("/servers/list/top/#{page}?limit=#{limit}") end end |