Contacts

Fetch users' contact lists without asking them to provide their passwords, as painlessly as possible.

Contacts provides adapters for:

Basic usage instructions

First, register your application with the service providers you require. Instructions below under “Setting up your accounts”.

Now, create a consumer:

consumer = Contacts::Google.new
consumer = Contacts::Yahoo.new
consumer = Contacts::WindowsLive.new
# OR by parameter:
# provider is one of :google, :yahoo, :windows_live
consumer = Contacts.new_consumer(provider)

Now, direct your user to:

consumer.authentication_url(return_url)

return_url is the page the user will be redirected to by the service once authorization has been granted. You should also persist the consumer object so you can grab the contacts once the user returns:

session[:consumer] = consumer.serialize

Now in the request handler of the return_url above:

consumer = Contacts.deserialize(session[:consumer])
if consumer.authorize(params)
  @contacts = consumer.contacts
else
  # handle error
end

Here, params is the hash of request parameters that the user returns with. consumer.authorize returns true if the authorization was successful, false otherwise.

The list of @contacts are Contacts::Contact objects which have these attributes:

Setting up your accounts

Google

Set up your projects here.

What this means:

Yahoo

Set up your projects here

What this means:

Windows Live

Set up your projects here.

What this means:

Copyright © 2010 George Ogata See LICENSE for details.

Derived from Mislav’s Contacts, Copyright © 2009 Mislav Marohnić