Avoid calls to remote census api (legacy) when endpoint is not defined

Also keep the same behavior for test and development environments.
This commit is contained in:
Senén Rodero Rodríguez
2019-10-18 13:06:50 +02:00
parent 970c3238fb
commit a733bc7b2e

View File

@@ -79,8 +79,12 @@ class CensusApi
nivel: 3 }}
end
def end_point_defined?
Rails.application.secrets.census_api_end_point.present?
end
def end_point_available?
Rails.env.staging? || Rails.env.preproduction? || Rails.env.production?
(Rails.env.staging? || Rails.env.preproduction? || Rails.env.production?) && end_point_defined?
end
def stubbed_response(document_type, document_number)