demarches-normaliennes/app/lib/api_entreprise/entreprise_adapter.rb
2018-03-29 11:44:59 +02:00

34 lines
718 B
Ruby

class ApiEntreprise::EntrepriseAdapter < ApiEntreprise::Adapter
def to_params
if data_source.present?
params = data_source[:entreprise].slice(*attr_to_fetch)
params[:date_creation] = Time.at(params[:date_creation]).to_datetime
params
else
{}
end
end
private
def get_resource
ApiEntreprise::API.entreprise(@siret_or_siren, @procedure_id)
end
def attr_to_fetch
[
:siren,
:capital_social,
:numero_tva_intracommunautaire,
:forme_juridique,
:forme_juridique_code,
:nom_commercial,
:raison_sociale,
:siret_siege_social,
:code_effectif_entreprise,
:date_creation,
:nom,
:prenom
]
end
end