aiderss / ruby-postrank forked from dj2/ruby-postrank
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (1)
- Wiki (1)
- Graphs
-
Tree:
002db1c
Joshua Hull (author)
Tue Jan 06 09:04:57 -0800 2009
ruby-postrank / README.rdoc
| 4b918a88 » | dj2 | 2008-07-16 | 1 | = Ruby PostRank | |
| f0b88286 » | dj2 | 2008-07-16 | 2 | A simple wrapper around the PostRank.com REST API. I've tried to keep the | |
| 3 | API simple without it being a bare API wrapper. | ||||
| 4 | |||||
| ac408cce » | dan sinclair | 2008-12-03 | 5 | = Dependencies | |
| 6 | You will need the OAuth gem installed in order to use Ruby PostRank. | ||||
| 7 | - sudo gem install oauth | ||||
| 8 | |||||
| 4b918a88 » | dj2 | 2008-07-16 | 9 | = Walkthrough | |
| f0b88286 » | dj2 | 2008-07-16 | 10 | I've tried to keep the API as simple as possible. It's about one step above | |
| 11 | the bare PostRank API. Hopefully the added abstraction is useful. The | ||||
| 12 | easiest way to explain this is probably to show an example. So, here we go. | ||||
| 13 | |||||
| 4b918a88 » | dj2 | 2008-07-16 | 14 | #!/usr/bin/env ruby | |
| 15 | |||||
| 16 | require 'rubygems' | ||||
| 17 | require 'postrank' | ||||
| 18 | |||||
| 19 | include PostRank | ||||
| fcce0c55 » | dj2 | 2008-11-08 | 20 | ||
| 21 | conn = Connection.instance | ||||
| 22 | conn.appkey = "everburning.com/ruby-postrank" | ||||
| 23 | eb = Feed.find_by_url("http://everburning.com") | ||||
| 4b918a88 » | dj2 | 2008-07-16 | 24 | ||
| 25 | puts "The GREAT everburning feeds" | ||||
| 26 | eb.entries(:level => Level::GREAT).each do |entry| | ||||
| 27 | puts entry | ||||
| 28 | end | ||||
| 29 | |||||
| 30 | puts "\nThe top 5 posts in the last week on everburning" | ||||
| fcce0c55 » | dj2 | 2008-11-08 | 31 | eb.topposts(:period => Period::WEEK).each do |entry| | |
| 32 | puts "#{entry.title} -- #{entry.postrank} -- #{entry.postrank_color}" | ||||
| 4b918a88 » | dj2 | 2008-07-16 | 33 | end | |
| 34 | |||||
| 35 | puts "\nGet thematic PostRanked items" | ||||
| fcce0c55 » | dj2 | 2008-11-08 | 36 | PostRank::PostRank.calculate(["http://flickr.com/photos/14009462@N00/2654539960/", | |
| 4b918a88 » | dj2 | 2008-07-16 | 37 | "http://www.flickr.com/photos/21418584@N07/2447928272/", | |
| 38 | "http://www.flickr.com/photos/pilou/2655293624/"]).each do |entry| | ||||
| ac408cce » | dan sinclair | 2008-12-03 | 39 | puts "#{entry.original_link} #{entry.postrank}" | |
| 4b918a88 » | dj2 | 2008-07-16 | 40 | end | |
| 41 | |||||
| 42 | puts "\nGet PostRanked items" | ||||
| fcce0c55 » | dj2 | 2008-11-08 | 43 | PostRank::PostRank.calculate(['http://everburning.com/news/on-recent-media/', | |
| 4b918a88 » | dj2 | 2008-07-16 | 44 | 'http://everburning.com/news/californication/', | |
| 45 | 'http://everburning.com/news/the-weary-traveler/'], | ||||
| 46 | :feeds => [eb]).each do |entry| | ||||
| ac408cce » | dan sinclair | 2008-12-03 | 47 | puts "#{entry.original_link} #{entry.postrank}" | |
| 4b918a88 » | dj2 | 2008-07-16 | 48 | end | |
| f0b88286 » | dj2 | 2008-07-16 | 49 | ||
| 50 | That's basically it. | ||||
| 51 | |||||
| 4b918a88 » | dj2 | 2008-07-16 | 52 | = Contact | |
| f0b88286 » | dj2 | 2008-07-16 | 53 | If you've got any questions, comments or bugs, please let me know. You can | |
| fcce0c55 » | dj2 | 2008-11-08 | 54 | contact me by email at dan at aiderss dot com. | |
| f0b88286 » | dj2 | 2008-07-16 | 55 | ||
| d8d4203a » | dj2 | 2008-07-15 | 56 | ||
