feat (api particulier): add Pole emploi field
This commit is contained in:
parent
4cfc9f7d86
commit
6ab8ac0662
28 changed files with 429 additions and 58 deletions
47
app/models/champs/pole_emploi_champ.rb
Normal file
47
app/models/champs/pole_emploi_champ.rb
Normal file
|
@ -0,0 +1,47 @@
|
|||
# == Schema Information
|
||||
#
|
||||
# Table name: champs
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# data :jsonb
|
||||
# fetch_external_data_exceptions :string is an Array
|
||||
# private :boolean default(FALSE), not null
|
||||
# rebased_at :datetime
|
||||
# row :integer
|
||||
# type :string
|
||||
# value :string
|
||||
# value_json :jsonb
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
# dossier_id :integer
|
||||
# etablissement_id :integer
|
||||
# external_id :string
|
||||
# parent_id :bigint
|
||||
# type_de_champ_id :integer
|
||||
#
|
||||
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 blank?
|
||||
external_id.nil?
|
||||
end
|
||||
|
||||
def fetch_external_data?
|
||||
true
|
||||
end
|
||||
|
||||
def fetch_external_data
|
||||
return if !valid?
|
||||
|
||||
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
|
Loading…
Add table
Add a link
Reference in a new issue