2015-11-16 11:23:29 +01:00
|
|
|
class SIADE::ExercicesAdapter
|
|
|
|
def initialize(siret)
|
|
|
|
@siret = siret
|
|
|
|
end
|
|
|
|
|
|
|
|
def data_source
|
|
|
|
@data_source ||= JSON.parse(SIADE::API.exercices(@siret), symbolize_names: true)
|
|
|
|
rescue
|
|
|
|
@data_source = nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def to_params
|
2016-01-20 10:34:22 +01:00
|
|
|
data_source[:exercices]
|
2015-11-16 11:23:29 +01:00
|
|
|
rescue
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def attr_to_fetch
|
|
|
|
[:ca,
|
|
|
|
:dateFinExercice,
|
|
|
|
:date_fin_exercice_timestamp]
|
|
|
|
end
|
|
|
|
end
|