February 15, 2011

A Ruby gem to access the Geni API.

With grandparents doing genealogy for years, I’ve always been doing genealogy the geek-way : playing with different crappy software, developed mine while in college, etc.

I discovered Geni and switched to it a couple of months ago. Geni lets you build your tree in a collaborative way. Everything online, with GEDCOM support.

They now have a public REST API which uses OAuth 2. Once authenticated, you can access all your data and do what you want with it.

I’ve been working some evenings to get a small Ruby gem intended to access the Geni API. If you are a Ruby developer and you consider using their API, please take a look at it and give me your feedback (and contribute!). Now find below some examples of usage.

Create a client and authenticate :

geni = Geni::Client.new({
  :app_id     => 'XX',
  :app_secret => 'XX',
  :token      => 'XX'
})

Access a given profile’s informations :

somebody = geni.get_profile('an_id')
puts somebody.name
puts somebody.birth_date

Use this to get the requester’s profile :

geni.get_profile

You have access to all immediately related profiles (parents, siblings, children and partners) :

somebody.parents.each do |profile|
  puts profile.name
end

somebody.children.each do |profile|
  puts profile.name
end

somebody.siblings.each do |profile|
  puts profile.name
end

I also pushed on GitHub a full demo Rails app demonstrating how to build a full Geni application.

This is all it does yet (and all I need). There are some bugs I guess, and the code might be improved. There are no tests for the code (if you are interested in contributing tests, I’d be pleased!).

Maybe I’ll get a free shirt for hacking this :-p

Vous voulez travailler avec moi ?

Je suis développeur et consultant sur des projets informatiques dans ma société, Phonoid. Avec mes amis, nous y développons des solutions sur mesure pour nos clients. Nous travaillons également sur nos futurs produits.