如何使用 ROR+LinkedIn 获取用户配置文件



嗨,一旦身份验证成功,我正在尝试获取这样的用户配置文件信息,

class LinkController < ApplicationController
  def callback
    client = LinkedIn::Client.new("ddddd", "ffffff")
    if session[:atoken].nil?
      pin = params[:oauth_verifier]
      atoken, asecret = client.authorize_from_request(session[:rtoken], session[:rsecret], pin)
      session[:atoken] = atoken
      session[:asecret] = asecret
    else
      client.authorize_from_access(session[:atoken], session[:asecret])
    end
    @profile = client.profile
    @connections = client.connections
    puts client.profile(:fields => [:positions]).positions 
    puts client.connections
  end
end

我得到的结果如下:

#<LinkedIn::Profile:0x4a6fdd8>
#<LinkedIn::Profile:0x4a58f30>
#<LinkedIn::Profile:0x4a58af8>
#<LinkedIn::Profile:0x4a58708>
#<LinkedIn::Profile:0x4a583a8>

我真的不明白这是什么,如果信息正确,而不是如何将其与用户可读性相结合,

我是 ROR 的新手,请帮助我解决这个问题。

这些是对象;使用 inspect 方法返回人类可读的表示形式:

client.profile.inspect

最新更新