diff --git a/lib/linked_in/api/query_methods.rb b/lib/linked_in/api/query_methods.rb index 106c8ad5..dc836726 100644 --- a/lib/linked_in/api/query_methods.rb +++ b/lib/linked_in/api/query_methods.rb @@ -42,6 +42,14 @@ def company_updates_likes(update_key, options={}) path = "#{company_path(options)}/updates/key=#{update_key}/likes" simple_query(path, options) end + + def suggested_companies + simple_query('/people/~/suggestions/to-follow/companies') + end + + def followed_companies + simple_query('/people/~/following/companies') + end def job(options = {}) path = jobs_path(options) diff --git a/spec/cases/api_spec.rb b/spec/cases/api_spec.rb index e300859c..4887b275 100644 --- a/spec/cases/api_spec.rb +++ b/spec/cases/api_spec.rb @@ -175,7 +175,7 @@ stub_request(:get, "https://api.linkedin.com/v1/companies/id=1586/updates/key=company_update_key/likes").to_return(:body => "{}") client.company_updates_likes("company_update_key", :id => 1586).should be_an_instance_of(LinkedIn::Mash) end - + it "should be able to follow a company" do stub_request(:post, "https://api.linkedin.com/v1/people/~/following/companies").to_return(:body => "", :status => 201) @@ -191,7 +191,16 @@ response.body.should == nil response.code.should == "201" end + + it "should be able to retrive list of companies user currently following" do + stub_request(:get, "https://api.linkedin.com/v1/people/~/following/companies").to_return(:body => "{}") + client.followed_companies.should be_an_instance_of(LinkedIn::Mash) + end + it "should be able to retrive list of suggested companies to follow" do + stub_request(:get, "https://api.linkedin.com/v1/people/~/suggestions/to-follow/companies").to_return(:body => "{}") + client.suggested_companies.should be_an_instance_of(LinkedIn::Mash) + end end context "Job API" do