demarches-normaliennes/app/lib/api_entreprise/entreprise_adapter.rb

36 lines
780 B
Ruby
Raw Normal View History

class ApiEntreprise::EntrepriseAdapter < ApiEntreprise::Adapter
2018-02-21 16:29:22 +01:00
private
def get_resource
ApiEntreprise::API.entreprise(siren, @procedure_id)
2018-03-15 14:30:10 +01:00
end
def process_params
params = data_source[:entreprise]&.slice(*attr_to_fetch)
if params.present? && valid_params?(params)
2018-10-25 15:29:25 +02:00
params[:date_creation] = Time.zone.at(params[:date_creation]).to_datetime
params.transform_keys { |k| :"entreprise_#{k}" }
else
{}
end
end
2015-08-10 11:05:06 +02:00
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
]
2015-08-10 11:05:06 +02:00
end
end