Class: HailHydra::TPB
- Inherits:
-
Object
- Object
- HailHydra::TPB
- Defined in:
- lib/client.rb
Overview
The TPB class provides the main client to connect to and scrape the results.
Instance Method Summary collapse
-
#initialize(domain = "https://apibay.org") ⇒ TPB
constructor
remember the domain name and get the cookie to use from the TPB server.
-
#search(query) ⇒ Object
search torrents.
Constructor Details
#initialize(domain = "https://apibay.org") ⇒ TPB
remember the domain name and get the cookie to use from the TPB server
12 13 14 |
# File 'lib/client.rb', line 12 def initialize domain="https://apibay.org" @domain = domain end |
Instance Method Details
#search(query) ⇒ Object
search torrents
17 18 19 20 21 |
# File 'lib/client.rb', line 17 def search query get = make_search_request query raise "Invalid response: #{get.response.code}" unless get.response.code == "200" return parse_search_results JSON.parse(get.response.body) end |