diff --git a/app/lib/carto/sgmap/api.rb b/app/lib/carto/sgmap/api.rb index 9ab7a9d9e..e084caebd 100644 --- a/app/lib/carto/sgmap/api.rb +++ b/app/lib/carto/sgmap/api.rb @@ -3,13 +3,13 @@ class CARTO::SGMAP::API end def self.search_qp(geojson) - endpoint = "/quartiers-prioritaires/search" - call(base_url + endpoint, { geojson: geojson.to_s }) + url = [API_CARTO_URL, "quartiers-prioritaires", "search"].join("/") + call(url, { geojson: geojson.to_s }) end def self.search_cadastre(geojson) - endpoint = "/cadastre/geometrie" - call(base_url + endpoint, { geojson: geojson.to_s }) + url = [API_CARTO_URL, "cadastre", "geometrie"].join("/") + call(url, { geojson: geojson.to_s }) end private @@ -25,8 +25,4 @@ class CARTO::SGMAP::API rescue RestClient::InternalServerError raise RestClient::ResourceNotFound end - - def self.base_url - 'https://apicarto.sgmap.fr' - end end diff --git a/config/initializers/urls.rb b/config/initializers/urls.rb index 82bdcf98f..f9419be37 100644 --- a/config/initializers/urls.rb +++ b/config/initializers/urls.rb @@ -1,3 +1,5 @@ +API_CARTO_URL = "https://apicarto.sgmap.fr" + API_ENTREPRISE_URL = 'https://entreprise.api.gouv.fr/v2' PIPEDRIVE_API_URL = 'https://api.pipedrive.com/v1'