Remove useless success? methods
This commit is contained in:
parent
a9c1c9f551
commit
3dd76c3d68
3 changed files with 6 additions and 14 deletions
|
@ -4,10 +4,6 @@ class ApiEntreprise::EntrepriseAdapter
|
|||
@procedure_id = procedure_id
|
||||
end
|
||||
|
||||
def success?
|
||||
data_source.present?
|
||||
end
|
||||
|
||||
def to_params
|
||||
if data_source.present?
|
||||
params = data_source[:entreprise].slice(*attr_to_fetch)
|
||||
|
|
|
@ -4,10 +4,6 @@ class ApiEntreprise::EtablissementAdapter
|
|||
@procedure_id = procedure_id
|
||||
end
|
||||
|
||||
def success?
|
||||
data_source.present?
|
||||
end
|
||||
|
||||
def to_params
|
||||
if data_source.present?
|
||||
params = data_source[:etablissement].slice(*attr_to_fetch)
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
class SIRETService
|
||||
def self.fetch(siret, dossier = nil)
|
||||
etablissement = ApiEntreprise::EtablissementAdapter.new(siret, dossier&.procedure_id)
|
||||
entreprise = ApiEntreprise::EntrepriseAdapter.new(siren(siret), dossier&.procedure_id)
|
||||
etablissement_params = ApiEntreprise::EtablissementAdapter.new(siret, dossier&.procedure_id).to_params
|
||||
entreprise_params = ApiEntreprise::EntrepriseAdapter.new(siren(siret), dossier&.procedure_id).to_params
|
||||
|
||||
if etablissement.success? && entreprise.success?
|
||||
if etablissement_params.present? && entreprise_params.present?
|
||||
association = ApiEntreprise::RNAAdapter.new(siret, dossier&.procedure_id)
|
||||
exercices = ApiEntreprise::ExercicesAdapter.new(siret, dossier&.procedure_id)
|
||||
|
||||
params = etablissement.to_params
|
||||
.merge(entreprise.to_params.map { |k,v| ["entreprise_#{k}", v] }.to_h)
|
||||
params = etablissement_params
|
||||
.merge(entreprise_params.map { |k,v| ["entreprise_#{k}", v] }.to_h)
|
||||
.merge(association.to_params&.map { |k,v| ["association_#{k}", v] }.to_h)
|
||||
.merge(exercices_attributes: exercices.to_array)
|
||||
|
||||
# This is to fill legacy models and relationships
|
||||
if dossier.present?
|
||||
return params.merge(
|
||||
entreprise_attributes: entreprise.to_params
|
||||
entreprise_attributes: entreprise_params
|
||||
.merge({
|
||||
dossier: dossier,
|
||||
rna_information_attributes: association.to_params
|
||||
|
|
Loading…
Reference in a new issue