Delete SiretService.siren, move its code to EntrepriseAdapter#get_resource

This commit is contained in:
gregoirenovel 2018-03-29 12:15:33 +02:00
parent feeb0cc80b
commit 8938a5b40d
2 changed files with 3 additions and 6 deletions

View file

@ -2,7 +2,8 @@ class ApiEntreprise::EntrepriseAdapter < ApiEntreprise::Adapter
private
def get_resource
ApiEntreprise::API.entreprise(@siret_or_siren, @procedure_id)
siren = @siret_or_siren[0..8]
ApiEntreprise::API.entreprise(siren, @procedure_id)
end
def process_params

View file

@ -3,7 +3,7 @@ class SIRETService
procedure_id = dossier&.procedure_id
etablissement_params = ApiEntreprise::EtablissementAdapter.new(siret, procedure_id).to_params
entreprise_params = ApiEntreprise::EntrepriseAdapter.new(siren(siret), procedure_id).to_params
entreprise_params = ApiEntreprise::EntrepriseAdapter.new(siret, procedure_id).to_params
if etablissement_params.present? && entreprise_params.present?
association_params = ApiEntreprise::RNAAdapter.new(siret, procedure_id).to_params
@ -23,10 +23,6 @@ class SIRETService
end
end
def self.siren(siret)
siret[0..8]
end
def self.handle_legacy_models!(params, entreprise_params, dossier, association_params)
params[:entreprise_attributes] = entreprise_params.merge(
{