demarches-normaliennes/app/jobs/annuaire_education_update_job.rb
2021-01-15 11:50:02 +01:00

16 lines
354 B
Ruby

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