demarches-normaliennes/app/jobs/annuaire_education_update_job.rb

17 lines
354 B
Ruby
Raw Normal View History

2021-01-13 18:58:59 +01:00
class AnnuaireEducationUpdateJob < ApplicationJob
def perform(champ)
external_id = champ.external_id
2021-01-13 18:58:59 +01:00
if external_id.present?
2020-08-05 18:40:47 +02:00
data = APIEducation::AnnuaireEducationAdapter.new(external_id).to_params
2021-01-13 18:58:59 +01:00
if data.present?
champ.data = data
else
champ.external_id = nil
2021-01-13 18:58:59 +01:00
end
champ.save!
end
end
end