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

28 lines
520 B
Ruby
Raw Normal View History

class ApiEntreprise::ExercicesAdapter < ApiEntreprise::Adapter
def to_params
2018-03-15 14:41:04 +01:00
if data_source.present?
exercices_array = data_source[:exercices].map do |exercice|
2018-03-15 14:41:04 +01:00
exercice.slice(*attr_to_fetch)
end
{ exercices_attributes: exercices_array }
2018-03-15 14:41:04 +01:00
else
{}
end
2018-02-21 16:29:22 +01:00
end
private
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
[
:ca,
:date_fin_exercice,
:date_fin_exercice_timestamp
]
end
2017-04-04 15:27:04 +02:00
end