Facebook API
Well, the Facebook API was released a few days ago. It uses REST to retrieve data. There was a Java and a PHP library on the Dev site for it already… but I felt like making one for Ruby that could be used for Ruby scripts and Ruby on Rails apps because I wanted to make a web app that would turn your friends into vCards. I wrote mine called FBLIB… it only has classes for users and friends so far since that’s all I was going to use. It’s pretty elaborate though, except there is no error catching or documentation because I was writing this for myself in a hurry and I am lazy.
Anyways, I have it in my SVN repository at
http://ohpie.com/svn/fblib
After I finished writing it I realized that the Facebook API didn’t give you contact information, so it would be impossible to make useful vCards of all your friends. So I give up. Have fun with the source. It’s licensed under GPL, and I think it’s a lot cleaner than the other Ruby facebook libraries I have seen in the Facebook Developer group. It uses the REXML libraries that come with Ruby (REXML is pretty damn sweet!).
If you would like to contribute, drop me a line and I will give you write access to the repo.

August 23rd, 2006 at 2:43 pm
Hello, I’ve just started learning ruby and came across your api. I was a little confused on how to invoke your api. Can you please provide a small example. Sorry for asking such a lame question, but Iam a little confused.
August 23rd, 2006 at 3:22 pm
Sorry my question should have been, how do I get information on a facebook user. but not their friends. For ex: get users info , provides you the friends info. is there a way to get self info?
August 23rd, 2006 at 4:41 pm
You are given a User ID when you authenticate yourself. You can pass that in an array to getfriendinfo
August 23rd, 2006 at 7:28 pm
Thanks for your reply. it looks like your getSession only returns session, anyway to get uid?
August 23rd, 2006 at 9:24 pm
You can modify the session class to do it. I believe it stores it as well in the class. If I get around to it I will alter it, but it isn’t that big of a change.
August 23rd, 2006 at 10:57 pm
I figured it out thanks. I can add the code here if you would like. Iam now receiving this error when usin getUsersInfo
NoMethodError (undefined method `stringify_keys!’ for … :REXML::Element):
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1506:in `attributes=’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:1354:in `initialize_without_callbacks’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/callbacks.rb:236:in `initialize’
/lib/fbsession.rb:75:in `getUsersInfo’
August 23rd, 2006 at 11:01 pm
That’s interesting. If I have time this weekend I can look at it. Fire me an email and I can give you write access to the repository. mikelikespie at gmail
September 19th, 2006 at 6:39 am
First of all thanks for the cool library.
There is a small mistake in the code.
File user.rb line 132, the order of school name and year should be reverse. The first argument should be name and then year.