style check

This commit is contained in:
Tanguy PATTE 2015-08-20 16:46:46 +02:00
parent 752c40657d
commit 32da0fa891
3 changed files with 15 additions and 25 deletions

View file

@ -1,11 +1,9 @@
class SIADE::API
class << self
attr_accessor :token
end
def initialize
end
def self.entreprise(siren)

View file

@ -1,5 +1,4 @@
class SIADE::EntrepriseAdapter
def initialize(siren)
@siren = siren
end
@ -13,10 +12,8 @@ class SIADE::EntrepriseAdapter
def to_params
params = {}
data_source[:entreprise].each do |k,v|
if attr_to_fetch.include?(k)
params[k] = v
end
data_source[:entreprise].each do |k, v|
params[k] = v if attr_to_fetch.include?(k)
end
params
rescue

View file

@ -1,5 +1,4 @@
class SIADE::EtablissementAdapter
def initialize(siret)
@siret = siret
end
@ -11,16 +10,12 @@ class SIADE::EtablissementAdapter
def to_params
params = {}
data_source[:etablissement].each do |k,v|
if attr_to_fetch.include?(k)
params[k] = v
end
data_source[:etablissement].each do |k, v|
params[k] = v if attr_to_fetch.include?(k)
end
params[:adresse] = adresse
data_source[:etablissement][:adresse].each do |k,v|
if address_attribut_to_fetch.include?(k)
params[k] = v
end
data_source[:etablissement][:adresse].each do |k, v|
params[k] = v if address_attribut_to_fetch.include?(k)
end
params
end
@ -29,25 +24,25 @@ class SIADE::EtablissementAdapter
[:siret,
:siege_social,
:naf,
:libelle_naf,
]
:libelle_naf
]
end
def adresse
adresse = ''
[:l1, :l2, :l3, :l4, :l5].each do |line|
adresse = adresse + data_source[:etablissement][:adresse][line] + "\r\n" unless data_source[:etablissement][:adresse][line].nil?
adresse = adresse + data_source[:etablissement][:adresse][line] + "\r\n" unless data_source[:etablissement][:adresse][line].nil?
end
adresse
end
def address_attribut_to_fetch
[:numero_voie,
:type_voie,
:nom_voie,
:complement_adresse,
:code_postal,
:localite,
:code_insee_localite]
:type_voie,
:nom_voie,
:complement_adresse,
:code_postal,
:localite,
:code_insee_localite]
end
end