jobs_chaser 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jobs_chaser.rb +21 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3271e471df23ab93cd44e4a0293257758b7fe670de209b1020da1969f6322020
|
4
|
+
data.tar.gz: 706285922c1dbef755294c377f8fd9f79bf2b9ecfa79c7b251ea7caa33631ee8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bf6bc78b3c3756e059b36e6ca95c59b2215e6c3e7761deb217afa84af5a042285134b13ba1bb0147cba58c91a029cc13c391b33471c5f1af07303b4de37bc19
|
7
|
+
data.tar.gz: ed768cca777992bca03275feccd4050b106c184a9505620f75f21e530a077f766fc8b0177483244c1981a5816913ce98c4814bae0361339f28088e630bab12a1
|
data/lib/jobs_chaser.rb
CHANGED
@@ -23,6 +23,8 @@ class JobsChaser
|
|
23
23
|
|
24
24
|
job_list = JobFilter.discard(job_list, @title_keywords_file)
|
25
25
|
valid_jobs = JobFilter.filter_jobs(job_list, @description_keywords_file)
|
26
|
+
|
27
|
+
export(csv_filename, valid_jobs)
|
26
28
|
end
|
27
29
|
|
28
30
|
def select_api_client(site_name)
|
@@ -35,4 +37,23 @@ class JobsChaser
|
|
35
37
|
raise "Unsupported site: #{site_name}"
|
36
38
|
end
|
37
39
|
end
|
40
|
+
|
41
|
+
def export(csv_filename, offers)
|
42
|
+
if defined?(Rails)
|
43
|
+
# Running in a Rails project
|
44
|
+
rails_root = Rails.root
|
45
|
+
else
|
46
|
+
# Running outside a Rails project, use a fallback directory
|
47
|
+
rails_root = Pathname.new(__FILE__).dirname.dirname
|
48
|
+
end
|
49
|
+
|
50
|
+
output_path = rails_root.join('data', csv_filename)
|
51
|
+
|
52
|
+
CSV.open(output_path, 'w') do |csv|
|
53
|
+
csv << ['Date', 'Job Title', 'Company', 'Location', 'URL']
|
54
|
+
offers.each { |offer| csv << [Date.today, offer[:title], offer[:company], offer[:location], offer[:url]] }
|
55
|
+
end
|
56
|
+
|
57
|
+
puts "Job offers have been exported and saved to #{output_path}."
|
58
|
+
end
|
38
59
|
end
|