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:
@@ -79,8 +79,12 @@ class CensusApi
|
|||||||
nivel: 3 }}
|
nivel: 3 }}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def end_point_defined?
|
||||||
|
Rails.application.secrets.census_api_end_point.present?
|
||||||
|
end
|
||||||
|
|
||||||
def end_point_available?
|
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
|
end
|
||||||
|
|
||||||
def stubbed_response(document_type, document_number)
|
def stubbed_response(document_type, document_number)
|
||||||
|
|||||||
Reference in New Issue
Block a user