Redfinger is a simple Ruby library built to consume the Webfinger protocol. It's simple!
For more information about Webfinger, see:
Redfinger is a gem:
gem install redfinger
Just call it with an e-mail address of a domain that provides the Webfinger protocol:
require 'redfinger' .('[email protected]')
From there, you have access to the links provided in the response as well as some shortcuts for common uses:
finger = .('[email protected]') finger.open_id.first.to_s # => "http://www.google.com/profiles/youraccount"
Links are simple hash based objects that store the 'rel' URI (such as that for hCard, OpenID, etc.), the 'href' (the actual destination URI), and the content type if specified. Note you can also just use
#to_s on a link to get the destination URI.
So how can you use Webfinger to your advantage? Let's take the example of hCard. If you install the `mofo` library you can do this:
require 'mofo' require 'redfinger' hcard_uri = .('[email protected]').hcard.first.to_s hcard = hCard.find(hcard_uri) hcard.fn # => "Example Guy" hcard.title # => "Title guy gave himself on Google profile"
Note that the Webfinger protocol is still in its alpha/infancy and there will likely be many changes as time progresses. This library will do its best to stay up-to-date and current with these changes over time.
Note on Patches/Pull Requests
Fork the project.
Make your feature addition or bug fix.
Add tests for it. This is important so I don't break it in a future version unintentionally.
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
Send me a pull request. Bonus points for topic branches.
Copyright © 2010 Intridea, Inc. and Michael Bleigh. See LICENSE for details.