lib/stars/favstar.rb in stars-0.1.1 vs lib/stars/favstar.rb in stars-0.2.0

- old
+ new

@@ -1,16 +1,20 @@ +require 'nokogiri' module Stars class Favstar include HTTParty base_uri 'favstar.fm' - format :xml - attr_accessor :username - - def initialize(username) - @username = username - end - def recent - self.class.get("/users/#{@username}/rss")['rss']['channel']['item'] + def recent(username) + self.class.get("/users/#{username}/rss", + :format => :xml)['rss']['channel']['item'] + end + + def show(url) + # hardcode 17 to strip favstar domain for now + html = self.class.get(url[17..200], :format => :html) + Nokogiri::HTML(html).css('.avatarList img').collect do |img| + " ★ #{img.attributes['alt'].value}" + end end end end \ No newline at end of file