class CensusCaller

  def call(document_type, document_number)
    response = CensusApi.new.call(document_type, document_number)
    response = LocalCensus.new.call(document_type, document_number) unless response.valid?

    response
  end
end

class CensusCaller

  def 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
  end
end

Allow new call to RemoteCensusApi on CensusCaller
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
