Files
grecia/lib/census_caller.rb
taitus 4dfce4f245 RemoteCensusAPI accept :date_of_birth and :postal_code
New RemoteCensusAPI allow receive :date_of_birth and
:postal_code and use in request to endpoint always that have
been configured on remote_census_configuration:
  - Setting["remote_census.request.date_of_birth"]
  - Setting["remote_census.request.postal_code"]

Add new params to CensusCaller 'call' method.
2019-07-29 13:10:09 +02:00

14 lines
442 B
Ruby

class CensusCaller
def call(document_type, document_number, date_of_birth, postal_code)
if Setting["feature.remote_census"].present?
response = RemoteCensusApi.new.call(document_type, document_number, date_of_birth, postal_code)
else
response = CensusApi.new.call(document_type, document_number)
end
response = LocalCensus.new.call(document_type, document_number) unless response.valid?
response
end
end