Class: IndeedApiClient

Inherits:
BaseApiClient show all
Defined in:
lib/whos_using_what/api_clients/indeed_api_client.rb

Instance Attribute Summary

Attributes inherited from Base

#set_paths

Instance Method Summary collapse

Methods inherited from BaseApiClient

arraySearch, arry_to_str_delim, cleanup_url, #determineIfUsesTechnology, prepare_params_from_map_helper, starts_with?

Methods inherited from Base

set_paths

Constructor Details

#initializeIndeedApiClient

Returns a new instance of IndeedApiClient.



5
6
7
8
9
10
11
# File 'lib/whos_using_what/api_clients/indeed_api_client.rb', line 5

def initialize

  headless = Headless.new
  headless.start
  @browser = Watir::Browser.new :firefox

end

Instance Method Details

#perform_search(keyword, location_city_state, increment, start) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/whos_using_what/api_clients/indeed_api_client.rb', line 13

def perform_search keyword, location_city_state, increment, start

  query_url = [
      "http://api.indeed.com/ads/apisearch?publisher=8417074034192456",
      "&q=" << keyword << "+" << location_city_state <<
          "&format=json" <<
          "&start=" << start.to_s <<
          "&limit=" << increment.to_s <<
          "&v=2"
  ]

  url = (BaseApiClient.arry_to_str_delim query_url, "").strip
  url = url.tr(" ", "+")

  rawHtml = RestClient.get(url)
  JSON.parse(rawHtml)

end