Ruby Rails LInkedIn Gem (get connected or non-connected profile information)

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!

Answers


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.


I think if you need more information you can always use linkedin-scraper gem https://github.com/yatishmehta27/linkedin-scraper


Need Your Help

Deserializing a class containing a List<T>: Why is List initially filled with Nulls?

c# list serialization

I have a class Bar which contains a List&lt;Foo&gt;, with both Foo and Bar implementing ISerializable.

iOS and Swift: Sharing code between View Controllers

ios swift

I know I will need a good amount of code to be shared throughout my app's different view controllers and I'm not sure the best way of organizing my code. For instance, I know that both view control...