Constantize the API Adresse URL

This commit is contained in:
gregoirenovel 2018-10-15 16:36:16 +02:00
parent ca8af0e904
commit a7a6898ce3
2 changed files with 2 additions and 5 deletions

View file

@ -8,13 +8,9 @@ module ApiAdresse
end end
def call def call
RestClient.get(api_url, params: { q: @address, limit: @limit }) RestClient.get(API_ADRESSE_URL, params: { q: @address, limit: @limit })
rescue RestClient::ServiceUnavailable rescue RestClient::ServiceUnavailable
nil nil
end end
def api_url
'http://api-adresse.data.gouv.fr/search'
end
end end
end end

View file

@ -1,4 +1,5 @@
# API URLs # API URLs
API_ADRESSE_URL = "http://api-adresse.data.gouv.fr/search"
API_CARTO_URL = "https://apicarto.sgmap.fr" API_CARTO_URL = "https://apicarto.sgmap.fr"
API_ENTREPRISE_URL = "https://entreprise.api.gouv.fr/v2" API_ENTREPRISE_URL = "https://entreprise.api.gouv.fr/v2"
API_GEO_URL = "https://geo.api.gouv.fr" API_GEO_URL = "https://geo.api.gouv.fr"