ruby-on-rails – 如何获取Linkedin用户数据?

我正在使用Linkedin API来获取RoR项目中的用户内容.我关注 this博客.这是控制器代码

基本档案(工作正常)

client = get_client
profile = client.profile(:fields => ["first-name","last-name","maiden-name","formatted-name",:headline,:location,:industry,:summary,:specialties,"picture-url","public-profile-url"])

经验和职位:

client = get_client
positions = client.profile(:fields => [:positions]).positions.all

对于教育:

client = get_client
educations = client.profile(:fields => [:educations]).educations.all

而get_client

def get_client
linkedin_oauth_setting = LinkedinOauthSetting.find_by_user_id(current_user.id)
client = LinkedIn::Client.new('aaadad','dadada',@@config)
client.authorize_from_access(linkedin_oauth_setting.atoken,linkedin_oauth_setting.asecret)
client
end

对于范围我设置:

:request_token_path => '/uas/oauth/requestToken?scope=r_fullprofile'

我能够获得基本个人资料信息,但不能获得其他信息.对于其他领域,我变空了[].我在这做错了什么?

解决方法

我想你需要向Linkedin提出特殊授权才能访问这些数据. r_fullprofile仅适用于已注册的API.

>不需要任何特殊授权的数据:r_basicprofile
>需要申请LinkedIn合作伙伴计划的数据:r_fullprofile(See here)

看看this documentation in Linkedin’s website

申请到Linkedin的计划,visit this page

我今天早上申请,他们说他们会在15天内回复我.

祝你好运!

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...