简体   繁体   中英

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
)

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

Seems like you an using old version of this gem. This method was added in March 2015 and this gem is not released yet.

So, you should use latest version of gem from master :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM