I am using pengwynn linkedIn gem in my rails project. How do I follow a company given the company id. I have written the following code, but it is not working.
client = LinkedIn::Client.new('consumer_key', 'consumer_secret')
rtoken = client.request_token.token
rsecret = client.request_token.secret
client.request_token.authorize_url
=> "https://api.linkedin.com/uas/oauth/authorize?oauth_token=<generated_token>"
client.authorize_from_request(rtoken, rsecret, pin)
client.company(:id => <company_id>).follow
Any idea why it is not working or any other solution?
If you're using linkedin gem 0.3.x, it doesn't have a method to follow a company. It could be added in 2-0-stable branch.
Then I've same task, I just fork gem and add follow_company
method to /lib/linked_in/api/update_methods.rb
def follow_company(company_id)
path = "/people/~/following/companies"
post(path, {id: company_id}.to_json ,"Content-Type" => "application/json")
end
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.