demarches-normaliennes/app/models/champs/annuaire_education_champ.rb

20 lines
364 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2021-01-14 17:29:57 +01:00
class Champs::AnnuaireEducationChamp < Champs::TextChamp
2021-02-09 12:35:23 +01:00
def fetch_external_data?
true
2021-01-14 17:29:57 +01:00
end
2021-02-09 12:35:23 +01:00
def fetch_external_data
2021-02-19 11:29:08 +01:00
APIEducation::AnnuaireEducationAdapter.new(external_id).to_params
2021-01-14 17:29:57 +01:00
end
def selected_items
if external_id.present?
[{ value: external_id, label: value }]
else
[]
end
end
2021-01-14 17:29:57 +01:00
end