2018-03-28 15:24:43 +02:00
|
|
|
class ApiEntreprise::ExercicesAdapter < ApiEntreprise::Adapter
|
2018-03-19 15:43:15 +01:00
|
|
|
def to_params
|
2018-03-15 14:41:04 +01:00
|
|
|
if data_source.present?
|
2018-03-19 15:43:15 +01:00
|
|
|
exercices_array = data_source[:exercices].map do |exercice|
|
2018-03-15 14:41:04 +01:00
|
|
|
exercice.slice(*attr_to_fetch)
|
|
|
|
end
|
2018-03-19 15:43:15 +01:00
|
|
|
|
|
|
|
{ exercices_attributes: exercices_array }
|
2018-03-15 14:41:04 +01:00
|
|
|
else
|
2018-03-19 15:43:15 +01:00
|
|
|
{}
|
2017-12-01 10:56:29 +01:00
|
|
|
end
|
2018-02-21 16:29:22 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-03-19 15:05:56 +01:00
|
|
|
def get_resource
|
|
|
|
ApiEntreprise::API.exercices(@siret_or_siren, @procedure_id)
|
2018-03-15 14:30:10 +01:00
|
|
|
end
|
|
|
|
|
2018-02-21 16:29:22 +01:00
|
|
|
def attr_to_fetch
|
2018-03-19 15:22:51 +01:00
|
|
|
[
|
|
|
|
:ca,
|
|
|
|
:date_fin_exercice,
|
|
|
|
:date_fin_exercice_timestamp
|
|
|
|
]
|
2015-11-16 11:23:29 +01:00
|
|
|
end
|
2017-04-04 15:27:04 +02:00
|
|
|
end
|