Ruby Wrapper

0 views
Skip to first unread message

John Wulff

unread,
Apr 21, 2007, 2:27:08 PM4/21/07
to Digg API
I've written a Digg API wrapper in Ruby. So far it only supports
story retrieval but it will support the entire API very soon.

http://code.google.com/p/digg-ruby/

Enjoy!

John Wulff

unread,
Apr 24, 2007, 12:37:42 PM4/24/07
to Digg API
New code is up. The entire API should be implemented now.

John Wulff

unread,
Apr 24, 2007, 12:35:41 PM4/24/07
to Digg API
New code is on the Google Project Page. Full API should be supported
now.

On Apr 21, 11:27 am, John Wulff <johnwu...@gmail.com> wrote:

jowensby...@gmail.com

unread,
Apr 26, 2007, 4:39:17 PM4/26/07
to Digg API
Very cool. Thanks. Using your wrapper, I created a <a href="http://
code.whytheluckystiff.net/mouseHole/">mouseHole</a> user script that
displays the number of diggs for whatever page you are browsing.
Right now I am getting the number of diggs via string manipulation; is
that the best way to parse the stories response?

-jessi

Sandro

unread,
Apr 27, 2007, 12:06:58 AM4/27/07
to Digg API
I'm a bit of a ruby newb but I must say, your code looks pretty
amazing. Your USAGE makes the digg class look sooo ruby! I'm inspired
to figure out what you're doing in there, great job!

On Apr 24, 12:35 pm, John Wulff <johnwu...@gmail.com> wrote:

John Wulff

unread,
Apr 27, 2007, 1:21:44 AM4/27/07
to Digg API
I'm not quite sure what you mean. Post your code and I can help.

On Apr 26, 1:39 pm, "jowensbysandi...@gmail.com"

Stegg

unread,
Apr 27, 2007, 7:47:18 PM4/27/07
to Digg API
I've posted a short tutorial article on how to use John's ruby
wrapper, as
well as a link to the little digg histogram app I created with it. I
hope this helps some of you wanting to get started with this code.
Enjoy!

You can view the article here:

http://www.nuttersmark.com/blog/articles/2007/04/27/digging-
for-rubies-diggraphy-and-the-ruby-wrapper-for-the-digg-api

And my digg tool I call "diggraphy", here:

http://www.nuttersmark.com/diggtools/diggraphy

jowensby...@gmail.com

unread,
Apr 29, 2007, 11:19:41 PM4/29/07
to Digg API
I'm sorry; I don't know what I am doing. I'm trying to get the number
of diggs for a given url (i.e. non-digg url). This is how I tried to
parse the response using your wrapper lib...
digg = Digg.new
stories = digg.stories('stories/', :link => "http://
www.howtoforge.com/the_perfect_desktop_debian_etch")
start = stories.first.inspect.index('@diggs="').to_i + 8
# the response can vary... look for various values after
number of diggs (@diggs)
cstop = stories.inspect.index('", @container',start)
tstop = stories.inspect.index('", @topic', start)
if tstop < cstop
stop = tstop
else
stop = cstop
end
stop = stop.to_i - 2
num_of_diggs = stories.first.inspect.slice(start..stop)
What embarrassing code; apologies.

John Wulff

unread,
May 1, 2007, 1:46:22 AM5/1/07
to Digg API
Try this instead:

Digg.new.stories('stories', :link => 'http://www.howtoforge.com/
the_perfect_desktop_debian_etch').first.diggs

On Apr 29, 8:19 pm, "jowensbysandi...@gmail.com"


<jowensbysandi...@gmail.com> wrote:
> I'm sorry; I don't know what I am doing. I'm trying to get the number
> of diggs for a given url (i.e. non-digg url). This is how I tried to
> parse the response using your wrapper lib...
> digg = Digg.new

> stories = digg.stories('stories/', :link => "http://www.howtoforge.com/the_perfect_desktop_debian_etch")

Reply all
Reply to author
Forward
0 new messages