Module: LinkedIn::Api::CompanySearchMethods

Included in:
Client
Defined in:
lib/linked_in/api/company_search_methods.rb

Instance Method Summary collapse

Instance Method Details

#company_search(options = {}) ⇒ Object

Public: Search the LinkedIn service for companies

options - The Hash options used to refine the selection:

:sort  - Controls the search result order. 
:start - The people record to start the return from.
         Used for page wrapping when the total number
         of records matching the search exceeds count
         (default: 0).
:count - The number of companiy records to return 
         (default: 25).
:companies - The company fields to be returned
             (default: id,name,website-url)
:keywords  - The keywords to search for (optional).

Examples

> y linkedin.company_search(:keywords => "social,local",
                            :count => 2) 
---
companies:
  _count: 2
  _start: 0
  total: 8620
  all:
  - id: 1355
    name: DHL
    website_url: http://www.dhl.com
  - id: 15656
    name: AECOM
    website_url: www.aecom.com
  => nil

Returns a Hashie::Mash of the matched companies.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/linked_in/api/company_search_methods.rb', line 38

def company_search(options={})
  options.reverse_merge!({
    :sort => 'relevance',
    :start => 0,
    :count => 25,
    :companies => 'id,name,website-url'
  })

  path = "/company-search:(companies:(#{options[:companies]}))" +
         "?sort=#{options[:sort]}" +
         "&start=#{options[:start]}" +
         "&count=#{options[:count]}"
  
  path += "&keywords=#{CGI.escape(options[:keywords])}" if 
    options[:keywords]

  Mash.from_json(get(path))
end

#location(options = {}) ⇒ Object



58
59
60
61
# File 'lib/linked_in/api/company_search_methods.rb', line 58

def location(options={})
  path = "/people-search:(facets:(code,buckets:(code,name)))?company-name=microsoft&facets=location"
  simple_query(path)
end