-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
64 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
module Csv | ||
class ImportCsv | ||
def import_company_urls | ||
company_list = AtsIdentifiers.load | ||
|
||
company_csv = 'storage/new/company_urls.csv' | ||
|
||
puts Company.count | ||
puts "Creating new companies..." | ||
|
||
CSV.foreach(company_csv, headers: true) do |row| | ||
url = row['company_url'] | ||
ats, company = Url::CreateCompanyFromUrl.new(url).create_company | ||
company_list[ats.name] << company.ats_identifier if company&.persisted? | ||
end | ||
|
||
AtsIdentifiers.save(company_list) | ||
puts Company.count | ||
end | ||
|
||
def import_greenhouse_urls | ||
company_list = AtsIdentifiers.load | ||
|
||
jobs_csv = 'storage/new/grnhse_job_posting_urls.csv' | ||
|
||
puts Job.count | ||
puts "Creating new jobs..." | ||
|
||
CSV.foreach(jobs_csv, headers: true) do |row| | ||
url = row['posting_url'] | ||
ats, company = Url::CreateJobFromUrl.new(url).create_company_then_job | ||
company_list[ats.name] << company.ats_identifier if company&.persisted? | ||
end | ||
|
||
AtsIdentifiers.save(company_list) | ||
puts Job.count | ||
end | ||
|
||
def import_job_posting_urls | ||
company_list = AtsIdentifiers.load | ||
|
||
jobs_csv = 'storage/new/job_posting_urls.csv' | ||
|
||
puts Job.count | ||
puts "Creating new jobs..." | ||
|
||
CSV.foreach(jobs_csv, headers: true) do |row| | ||
url = row['posting_url'] | ||
ats, company = Url::CreateJobFromUrl.new(url).create_company_then_job | ||
company_list[ats.name] << company.ats_identifier if company&.persisted? | ||
end | ||
|
||
AtsIdentifiers.save(company_list) | ||
puts Job.count | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters