2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-12-01 10:21:30 +01:00
|
|
|
class Champs::PoleEmploiChamp < Champs::TextChamp
|
|
|
|
# see https://github.com/betagouv/api-particulier/blob/master/src/presentation/middlewares/pole-emploi-input-validation.middleware.ts
|
|
|
|
store_accessor :value_json, :identifiant
|
|
|
|
|
|
|
|
def fetch_external_data?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def fetch_external_data
|
2023-10-26 16:02:23 +02:00
|
|
|
return unless valid_champ_value?
|
2021-12-01 10:21:30 +01:00
|
|
|
|
|
|
|
APIParticulier::PoleEmploiAdapter.new(
|
|
|
|
procedure.api_particulier_token,
|
|
|
|
identifiant,
|
|
|
|
procedure.api_particulier_sources
|
|
|
|
).to_params
|
|
|
|
end
|
|
|
|
|
|
|
|
def external_id
|
|
|
|
{ identifiant: identifiant }.to_json if identifiant.present?
|
|
|
|
end
|
|
|
|
end
|