Method: DiceSearch.query

Defined in:
lib/dice/dice.rb

.query(location, keywords, days_back, num_entries) ⇒ Object

Query dice for html code for the query

Parameters:

  • location (String, #read)

    the location to search

  • keywords (String, #read)

    keywords to use for the search

  • days_back (String, #read)

    how long ago to search

  • num_entries (String, #read)

    the number of entries to request



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/dice/dice.rb', line 99

def self.query(location, keywords, days_back, num_entries)

	# The search URL
	url = "http://seeker.dice.com/jobsearch/servlet/JobSearch" +
		 "?caller=0&LOCATION_OPTION=2&EXTRA_STUFF=1&N=0&Hf=0" +
		 "&Ntk=JobSearchRanking&op=300" +
		 "&values=&FREE_TEXT=#{keywords}" +
		 "&Ntx=mode+matchall&WHERE=#{location}" +
		 "&WHEREList=#{location}" +
		 "&RADIUS=80.4672" +
		 "&COUNTRY=1525&STAT_PROV=0&METRO_AREA=33.78715899%2C-84.39164034&AREA_CODES=&AC_COUNTRY=1525" +
		 "&TRAVEL=0&TAXTERM=1001" +
		 "&SORTSPEC=0" +
		 "&FRMT=0" +
		 "&DAYSBACK=#{days_back}" +
		 "&NUM_PER_PAGE=#{num_entries}"

	# Read the data from the url
	open(@url, "User-Agent" => "Ruby/#{RUBY_VERSION}",
		"From" => "[email protected]",
		"Referer" => "http://seeker.dice.com/jobsearch/").read
end