Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two new API's added for companies #194

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/linked_in/api/query_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ def company_updates_likes(update_key, options={})
path = "#{company_path(options)}/updates/key=#{update_key}/likes"
simple_query(path, options)
end

def companies(options={})
path = companies_path(options)
simple_query(path)
end

def job(options = {})
path = jobs_path(options)
Expand Down Expand Up @@ -148,6 +153,15 @@ def company_path(options)
end
end

def companies_path(options)
path = "/people/~"
if options[:suggetions]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:suggestions not :suggetions

path += "/suggestions/to-follow/companies"
else
path += "/following/companies"
end
end

def picture_urls_path(options)
path = person_path(options)
path += "/picture-urls"
Expand Down
11 changes: 10 additions & 1 deletion spec/cases/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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.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.companies(suggetions: true).should be_an_instance_of(LinkedIn::Mash)
end
end

context "Job API" do
Expand Down