简体   繁体   English

带有linkedin-oauth2 gem的LinkedIn API的未定义方法“ company_search”

[英]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. 我想在Ruby on Rails项目中搜索具有LinkedIn API的公司。

I use linkedin-oauth2 gem to do this but when I try any company search, I have this error. 我使用linkedin-oauth2 gem来执行此操作,但是当我尝试任何公司搜索时,都会出现此错误。

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 如果您想使用方法( company_search )供自己使用

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

in your Gemfile then bundle install 在您的Gemfile然后bundle install

but use a stable version of the gem as recomended 但使用推荐的稳定版本的gem

Seems like you an using old version of this gem. 似乎您正在使用该宝石的旧版本。 This method was added in March 2015 and this gem is not released yet. 该方法在2015年3月添加 ,尚未发布。

So, you should use latest version of gem from master : 因此,您应该使用master最新版本的gem:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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