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

28 lines
545 B
Ruby
Raw Normal View History

class ApiEntreprise::ExercicesAdapter < ApiEntreprise::Adapter
2018-02-21 16:29:22 +01:00
private
def get_resource
ApiEntreprise::API.exercices(@siret, @procedure_id)
2018-03-15 14:30:10 +01:00
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
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