Navigation Menu

Skip to content

reidab/redfinger

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redfinger

Redfinger is a simple Ruby library built to consume the Webfinger protocol. It’s simple!

For more information about Webfinger, see:

Installation

Redfinger is a gem:

gem install redfinger

Usage

Just call it with an e-mail address of a domain that provides the Webfinger protocol:

require 'redfinger'

Redfinger.finger('youraccount@gmail.com')

From there, you have access to the links provided in the response as well as some shortcuts for common uses:

finger = Redfinger.finger('youraccount@gmail.com')
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 = Redfinger.finger('example@gmail.com').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.

About

A Ruby library for consuming Webfingers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%