Allow new call to RemoteCensusApi on CensusCaller

When Setting["feature.remote_census"] is active, we allow and
ability the calls to new RemoteCensusAPI througth CensusCaller
This commit is contained in:
taitus
2019-04-16 16:20:34 +02:00
committed by Javi Martín
parent 9e94cf060e
commit dc5c316caf

View File

@@ -1,7 +1,11 @@
class CensusCaller
def call(document_type, document_number)
response = CensusApi.new.call(document_type, document_number)
if Setting["feature.remote_census"].present?
response = RemoteCensusApi.new.call(document_type, document_number)
else
response = CensusApi.new.call(document_type, document_number)
end
response = LocalCensus.new.call(document_type, document_number) unless response.valid?
response