Permalink
Browse files

Added name and e-mail domain searching to companies

  • Loading branch information...
1 parent 09af8a7 commit d1c70c1c87829c9c4e775d35aa70ed08496ef93d Ryan Brunner committed Nov 10, 2011
Showing with 15 additions and 1 deletion.
  1. +5 −1 lib/linked_in/api/query_methods.rb
  2. +10 −0 spec/cases/api_spec.rb
@@ -51,9 +51,13 @@ def person_path(options)
def company_path(options)
path = "/companies/"
if options[:id]
- path += "id=#{options[:id]}"
+ path += options[:id]
elsif options[:url]
path += "url=#{CGI.escape(options[:url])}"
+ elsif options[:name]
+ path += "universal-name=#{CGI.escape(options[:name])}"
+ elsif options[:domain]
+ path += "email-domain=#{CGI.escape(options[:domain])}"
else
path += "~"
end
View
@@ -60,6 +60,16 @@
client.company(:id => 1586).should be_an_instance_of(LinkedIn::Mash)
end
+ it "should be able to view a company by universal name" do
+ stub_request(:get, "https://api.linkedin.com/v1/companies/universal-name=acme").to_return(:body => "{}")
+ client.company(:name => 'acme').should be_an_instance_of(LinkedIn::Mash)
+ end
+
+ it "should be able to view a company by e-mail domain" do
+ stub_request(:get, "https://api.linkedin.com/v1/companies/email-domain=acme.com").to_return(:body => "{}")
+ client.company(:domain => 'acme.com').should be_an_instance_of(LinkedIn::Mash)
+ end
+
it "should load correct company data" do
client.company(:id => 1586).name.should == "Amazon"

0 comments on commit d1c70c1

Please sign in to comment.