Skip to content

Commit b15a8fb

Browse files
author
Tom Copeland
committed
Some notes on using the RubyForge API with HTTParty
1 parent 9073da9 commit b15a8fb

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

public/index.html

+9-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,15 @@ <h3>Accessing the API</h3>
3535
<p><b>Quotas</b>: Please don't hit the API more than 3600 times per hour or you'll be blocked.</p>
3636

3737
<h4>Accessing the API via Ruby</h4>
38-
<p>TODO. Basically, see the rubyforge gem for some pointers. Or just use Net::HTTP or httparty along with the json library.</p>
38+
<p>Use John Nunemaker's excellent <a href="http://httparty.rubyforge.org/">HTTParty</a> library. Like this:</p>
39+
<pre>
40+
$ irb -rhttparty
41+
&gt;&gt; class RubyForge ; include HTTParty ; base_uri 'api.rubyforge.org' ; basic_auth 'username', 'password' ; end
42+
=&gt; {:username=&gt;>"username", :password=&gt;"password"}
43+
&gt;&gt; RubyForge.get('/mirrors').first
44+
=&gt; {"mirror"=&gt;{"updated_at"=&gt;Fri Aug 28 17:49:17 UTC 2009, "serves_gems"=&gt;true, "domain"=&gt;"rubyforge.vm.bytemark.co.uk", "url"=&gt;"http://gems.rubyforge.vm.bytemark.co.uk", "created_at"=&gt;Fri Aug 28 17:49:17 UTC 2009, "serves_files"=&gt;false}}
45+
</pre>
46+
3947
<h4>Accessing the API via curl</h4>
4048
<p>Edit your <code>~/.netrc</code> file and add your RubyForge username and password:</p>
4149
<pre>

0 commit comments

Comments
 (0)