After getting a profile hash from the LinkedIn Ruby Gem, but I’m looking for a way to get more information from the user, like skills, their connections, their email, their profile pic, etc. I’m not having any trouble accessing this info from the currently authenticated user, only getting this kind of information from the authenticated user’s connections, and from public profiles.
In my Rails app I have a users/show.haml.html that does this:
def show
#@users = User.all
@profile = linkedin_client.profile(:id => params[:id])
#how to get this user's connections etc?
end
For the currently authenticated user it’s relatively easy, to get the positions, id, and connections, just do this:
@positions = linkedin_client.profile(:fields => %w(positions)).positions.all
@id = linkedin_client.profile(:fields => 'id').id
@connections = linkedin_client.connections.all
Anybody know how I can get similar information with connections, or even non-connected public profiles? Perhaps I should use another tool like linkedin-scraper?
Thanks!
The answer is to use :fields then specify which profile fields you’d like returned like this:
@profile = linkedin_client.profile(:id => params[:id], :fields => %w(id first-name last-name location picture_url public_profile_url headline industry))
hope this helps somebody.