demarches-normaliennes/app/lib/api_entreprise/exercices_adapter.rb
Pierre de La Morinerie 150ddab660 zeitwerk: Api -> API
2021-02-09 13:07:30 +01:00

27 lines
545 B
Ruby

class APIEntreprise::ExercicesAdapter < APIEntreprise::Adapter
private
def get_resource
APIEntreprise::API.exercices(@siret, @procedure_id)
end
def process_params
exercices_array = data_source[:exercices].map do |exercice|
exercice.slice(*attr_to_fetch)
end
if exercices_array.all? { |params| valid_params?(params) }
{ exercices_attributes: exercices_array }
else
{}
end
end
def attr_to_fetch
[
:ca,
:date_fin_exercice,
:date_fin_exercice_timestamp
]
end
end