Search code examples
ruby-on-railsrubyrubygemslinkedin-api

undefined method `company_search' for LinkedIn API with linkedin-oauth2 gem


I want to search companies with LinkedIn API in a Ruby on Rails project.

I use linkedin-oauth2 gem to do this but when I try any company search, I have this error.

undefined method `company_search' for #<LinkedIn::API:0x007f88aad68bb8>

This is my code:

api = LinkedIn::API.new(access_token)
@companies = api.company_search(
    keyword: "technologies", 
    facets: "location,industry", 
    facet: ["location,us","industry,4"], 
    start: 0, 
    count: 1000000
)

Solution

  • If you want to use the method(company_search) for your own use

    gem 'linkedin-oauth2', github: 'emorikawa/linkedin-oauth2', branch: 'master' 
    

    in your Gemfile then bundle install

    but use a stable version of the gem as recomended