Class: AtlasEngine::Us::Jobs::AddressImporter::CombinedImportJob

Inherits:
ApplicationJob
  • Object
show all
Includes:
AddressImporter::ImportLogHelper
Defined in:
app/countries/atlas_engine/us/jobs/address_importer/combined_import_job.rb

Constant Summary collapse

COUNTRY_CODE =
"US"
LOCALE =
"en"
US_STATES =
[
  "AK",
  "AL",
  "AR",
  "AZ",
  "CA",
  "CO",
  "CT",
  "DC",
  "DE",
  "FL",
  "GA",
  "HI",
  "IA",
  "ID",
  "IL",
  "IN",
  "KS",
  "KY",
  "LA",
  "MA",
  "MD",
  "ME",
  "MI",
  "MN",
  "MO",
  "MS",
  "MT",
  "NC",
  "ND",
  "NE",
  "NH",
  "NJ",
  "NM",
  "NV",
  "NY",
  "OH",
  "OK",
  "OR",
  "PA",
  "RI",
  "SC",
  "SD",
  "TN",
  "TX",
  "UT",
  "VA",
  "VT",
  "WA",
  "WI",
  "WV",
  "WY",
]

Constants included from AddressImporter::ImportLogHelper

AddressImporter::ImportLogHelper::TEST_TIMESTAMP

Instance Method Summary collapse

Methods included from AddressImporter::ImportLogHelper

#import_log_error, #import_log_info

Methods included from LogHelper

#log_error, #log_info, #log_warn

Methods inherited from ApplicationJob

#argument

Instance Method Details

#perform(geojson_directory:) ⇒ Object



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'app/countries/atlas_engine/us/jobs/address_importer/combined_import_job.rb', line 71

def perform(geojson_directory:)
  country_import = AtlasEngine::CountryImport.create!(country_code: COUNTRY_CODE)
  country_import.start!

  import_log_info(
    country_import: country_import,
    message: "Starting import for #{COUNTRY_CODE} from #{geojson_directory}",
    notify: true,
  )

  jobs_to_run = job_list(geojson_directory, country_import)
  first_job = jobs_to_run.shift
  first_job[:job_name].perform_later(**first_job[:job_args].merge(followed_by: jobs_to_run))
end