Class: TSJobCrawler
- Inherits:
-
Object
- Object
- TSJobCrawler
- Defined in:
- lib/tsjobcrawler.rb
Overview
Crawls all the jobs that require clearance
Instance Method Summary collapse
- #clearance_jobs_com ⇒ Object
- #cleared_jobs_net ⇒ Object
-
#crawl_jobs ⇒ Object
Crawl all of the listing sites.
-
#gen_json ⇒ Object
Generate output.
-
#initialize(search_term, requests = nil, cm_hash = nil) ⇒ TSJobCrawler
constructor
A new instance of TSJobCrawler.
- #security_cleared_jobs_com ⇒ Object
Constructor Details
#initialize(search_term, requests = nil, cm_hash = nil) ⇒ TSJobCrawler
Returns a new instance of TSJobCrawler.
9 10 11 12 13 14 |
# File 'lib/tsjobcrawler.rb', line 9 def initialize(search_term, requests=nil, cm_hash=nil) @search_term = search_term @requests = requests @cm_hash = cm_hash @output = Array.new end |
Instance Method Details
#clearance_jobs_com ⇒ Object
29 30 31 32 33 |
# File 'lib/tsjobcrawler.rb', line 29 def clearance_jobs_com c = ClearanceJobsComCrawler.new(@search_term, @requests, @cm_hash) c.crawl @output += JSON.parse(c.gen_json) if @cm_hash == nil end |
#cleared_jobs_net ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/tsjobcrawler.rb', line 35 def cleared_jobs_net if @search_term == nil g = GetAllClearedJobs.new(@requests, @cm_hash) g.crawl @output += JSON.parse(g.gen_json) if @cm_hash == nil else # Scrape by search term c = ClearedJobsNetCrawler.new(@search_term, nil, @requests, @cm_hash) c.crawl_listings @output += JSON.parse(c.gen_json) if @cm_hash == nil end end |
#crawl_jobs ⇒ Object
Crawl all of the listing sites
17 18 19 20 21 |
# File 'lib/tsjobcrawler.rb', line 17 def crawl_jobs cleared_jobs_net clearance_jobs_com security_cleared_jobs_com end |
#gen_json ⇒ Object
Generate output
48 49 50 |
# File 'lib/tsjobcrawler.rb', line 48 def gen_json JSON.pretty_generate(@output) end |
#security_cleared_jobs_com ⇒ Object
23 24 25 26 27 |
# File 'lib/tsjobcrawler.rb', line 23 def security_cleared_jobs_com c = SecurityClearedJobsComCrawler.new(@search_term, @requests, @cm_hash) c.crawl @output += JSON.parse(c.gen_json) if @cm_hash == nil end |