2018-03-28 15:24:43 +02:00
|
|
|
class ApiEntreprise::Adapter
|
2018-10-04 16:22:19 +02:00
|
|
|
UNAVAILABLE = 'Donnée indisponible'
|
|
|
|
|
2018-03-29 12:16:46 +02:00
|
|
|
def initialize(siret, procedure_id)
|
|
|
|
@siret = siret
|
2018-03-28 15:24:43 +02:00
|
|
|
@procedure_id = procedure_id
|
|
|
|
end
|
2018-03-19 15:05:56 +01:00
|
|
|
|
|
|
|
def data_source
|
|
|
|
@data_source ||= get_resource
|
|
|
|
rescue
|
|
|
|
@data_source = nil
|
|
|
|
end
|
2018-03-19 15:45:55 +01:00
|
|
|
|
|
|
|
def to_params
|
|
|
|
if data_source.present?
|
|
|
|
process_params
|
|
|
|
else
|
|
|
|
{}
|
|
|
|
end
|
|
|
|
end
|
2018-10-04 16:22:19 +02:00
|
|
|
|
|
|
|
def valid_params?(params)
|
|
|
|
!params.has_value?(UNAVAILABLE)
|
|
|
|
end
|
2018-03-28 15:24:43 +02:00
|
|
|
end
|