Module: Glassdoor::Clients::Company

Defined in:
lib/glassdoor/clients/company.rb

Class Method Summary collapse

Class Method Details

.find_by_title(title) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/glassdoor/clients/company.rb', line 13

def self.find_by_title(title)
  api = Glassdoor::Utils::Api.instance
  hash  = api.gd_get(action: 'employers', q: title)

  if hash['employers'].any?
    company = hash['employers'].find { |h| h['exactMatch'] }
    Models::Company.new(company)
  else
    nil
  end
end

.search_by_title(title, page = 1, per_page = 20) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/glassdoor/clients/company.rb', line 4

def self.search_by_title(title, page = 1, per_page = 20)
  api = Glassdoor::Utils::Api.instance
  hash  = api.gd_get(action: 'employers', q: title, pn: page, ps: per_page)

  hash['employers'].map do |company|
    Models::Company.new(company)
  end
end