data_source methods can be private

This commit is contained in:
gregoirenovel 2018-03-15 14:30:10 +01:00
parent 9a7e13f72f
commit 96f78b6213
4 changed files with 20 additions and 20 deletions

View file

@ -4,12 +4,6 @@ class SIADE::EntrepriseAdapter
@procedure_id = procedure_id @procedure_id = procedure_id
end end
def data_source
@data_source ||= SIADE::API.entreprise(@siren, @procedure_id)
rescue
@data_source = nil
end
def success? def success?
data_source data_source
rescue rescue
@ -26,6 +20,12 @@ class SIADE::EntrepriseAdapter
private private
def data_source
@data_source ||= SIADE::API.entreprise(@siren, @procedure_id)
rescue
@data_source = nil
end
def attr_to_fetch def attr_to_fetch
[ [
:siren, :siren,

View file

@ -4,10 +4,6 @@ class SIADE::EtablissementAdapter
@procedure_id = procedure_id @procedure_id = procedure_id
end end
def data_source
@data_source ||= SIADE::API.etablissement(@siret, @procedure_id)
end
def success? def success?
data_source data_source
rescue rescue
@ -26,6 +22,10 @@ class SIADE::EtablissementAdapter
private private
def data_source
@data_source ||= SIADE::API.etablissement(@siret, @procedure_id)
end
def attr_to_fetch def attr_to_fetch
[ [
:adresse, :adresse,

View file

@ -4,12 +4,6 @@ class SIADE::ExercicesAdapter
@procedure_id = procedure_id @procedure_id = procedure_id
end end
def data_source
@data_source ||= SIADE::API.exercices(@siret, @procedure_id)
rescue
@data_source = nil
end
def to_params def to_params
data_source[:exercices].map do |exercice| data_source[:exercices].map do |exercice|
exercice.slice(*attr_to_fetch) exercice.slice(*attr_to_fetch)
@ -20,6 +14,12 @@ class SIADE::ExercicesAdapter
private private
def data_source
@data_source ||= SIADE::API.exercices(@siret, @procedure_id)
rescue
@data_source = nil
end
def attr_to_fetch def attr_to_fetch
[:ca, :date_fin_exercice, :date_fin_exercice_timestamp] [:ca, :date_fin_exercice, :date_fin_exercice_timestamp]
end end

View file

@ -4,10 +4,6 @@ class SIADE::RNAAdapter
@procedure_id = procedure_id @procedure_id = procedure_id
end end
def data_source
@data_source ||= SIADE::API.rna(@siret, @procedure_id)
end
def to_params def to_params
if data_source[:association][:id].nil? if data_source[:association][:id].nil?
return nil return nil
@ -21,6 +17,10 @@ class SIADE::RNAAdapter
private private
def data_source
@data_source ||= SIADE::API.rna(@siret, @procedure_id)
end
def attr_to_fetch def attr_to_fetch
[ [
:titre, :titre,