lib/nnmClub_api.rb in nnmClub_api-0.0.1 vs lib/nnmClub_api.rb in nnmClub_api-0.0.2

- old
+ new

@@ -4,19 +4,18 @@ require "json" class NnmclubApi attr_accessor :agent, :result - LOGIN_PAGE = 'http://nnm-club.me/forum/login.php' SEARCH_PAGE = 'http://nnm-club.me/forum/tracker.php' 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 } SORT_OPTIONS = {asc: 1, desc: 2} - def initialize(username, password) + def initialize @agent = Mechanize.new @agent.user_agent_alias = "Mac Safari" end def result @@ -32,10 +31,9 @@ parse_search end private def prepare_query_string(options) - #?q=lorem+ipsum&w=title SEARCH_PAGE+"?nm="+options[:title].gsub(/\s/,'%20') end def parse_search @agent.page.search("//table[@class='forumline tablesorter']/tbody/tr").map do |row|