Module: Rst::Client
Instance Method Summary collapse
Instance Method Details
#base_uri ⇒ Object
8 9 10 |
# File 'lib/rst/client.rb', line 8 def base_uri "http://rstat.us" end |
#hydra ⇒ Object
33 34 35 |
# File 'lib/rst/client.rb', line 33 def hydra Typhoeus::Hydra.hydra end |
#messages_all(params = {:page => 1}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rst/client.rb', line 12 def (params = {:page => 1}) root_response = Nokogiri::HTML.parse( Typhoeus::Request.get(base_uri).body ) link = root_response.xpath( "//a[contains(@rel, 'messages-all')]" ).first url = (URI(base_uri) + URI(link["href"])).to_s all_response = Nokogiri::HTML.parse( Typhoeus::Request.get(url).body ) = all_response.css("div#messages ul.all li").map { |li| Rst::Status.parse(li) } end |