demarches-normaliennes/app/jobs/annuaire_education_update_job.rb
2021-01-14 17:57:48 +01:00

16 lines
342 B
Ruby

class AnnuaireEducationUpdateJob < ApplicationJob
def perform(champ)
search_term = champ.value
if search_term.present?
data = ApiEducation::AnnuaireEducationAdapter.new(search_term).to_params
if data.present?
champ.data = data
else
champ.value = nil
end
champ.save!
end
end
end