demarches-normaliennes/app/jobs/annuaire_education_update_job.rb

17 lines
342 B
Ruby
Raw Normal View History

2021-01-13 18:58:59 +01:00
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