git clone 地址 git://github.com/mislav/contacts.git

我试了这个gem

可以通过API的方式获取MSN,Gmail,YAHOO,Flickr的联系人信息。

也就是说密码是在目标网站上输入的,而不是在第三方的网站上输入密码的。

这个倒是不错。

我测试了msn跟gmail

msn倒是成功了,gmail的token似乎仍然失败。

代码:

[1code]
class InvitesController < ApplicationController
def index
end


def new
case params[:type]
when "google"
session[:google_account] = params[:account]
redirect_to Contacts::Google.authentication_url("http://www.fcid.net/invites/google",:secure=>true)
when "hotmail"
wl = Contacts::WindowsLive.new
redirect_to wl.get_authentication_url
when "yahoo"
yahoo = Contacts::Yahoo.new
redirect_to yahoo.get_authentication_url
when "flickr"
# 还未实现,等待 contacts 升级
end
end


def flickr
# 似乎还没有实现
end

def google
# 这个测试了,失败
token = params[:token]
gmail = Contacts::Google.new session[:google_account],token
@contacts = gmail.contacts
end

def yahoo
yahoo = Contacts::Yahoo.new
@contacts = yahoo.contacts request.request_uri
end

def msn
# 这个倒是成功了
wl = Contacts::WindowsLive.new
@contacts = wl.contacts request.raw_post
end

end
~
[/code1]