Class: RutrackerApi::Client
- Inherits:
-
Object
- Object
- RutrackerApi::Client
- Defined in:
- lib/rutracker_api/client.rb
Constant Summary collapse
- LOGIN_PAGE =
'https://rutracker.org/forum/login.php'.freeze
- SEARCH_PAGE =
'https://rutracker.org/forum/tracker.php'.freeze
- ORDER_OPTIONS =
{ date: 1, name: 2, downloads: 4, shows: 6, seeders: 10, leechers: 11, size: 7, last_post: 8, speed_up: 12, speed_down: 13, message_count: 5, last_seed: 9 }.freeze
- SORT_OPTIONS =
{ asc: 1, desc: 2 }.freeze
Instance Attribute Summary collapse
-
#agent ⇒ Object
Returns the value of attribute agent.
Instance Method Summary collapse
-
#initialize(username, pass) ⇒ Client
constructor
A new instance of Client.
-
#search(options = {}) ⇒ Hash
Advance search throw rutracker.
Constructor Details
#initialize(username, pass) ⇒ Client
Returns a new instance of Client.
18 19 20 21 22 |
# File 'lib/rutracker_api/client.rb', line 18 def initialize(username, pass) @agent = Mechanize.new @agent.user_agent_alias = 'Mac Safari' login(username, pass) end |
Instance Attribute Details
#agent ⇒ Object
Returns the value of attribute agent.
8 9 10 |
# File 'lib/rutracker_api/client.rb', line 8 def agent @agent end |
Instance Method Details
#search(options = {}) ⇒ Hash
Advance search throw rutracker
28 29 30 31 32 |
# File 'lib/rutracker_api/client.rb', line 28 def search( = {}) query = prepare_query_string @agent.get query parse_search end |