Merge pull request #3809 from betagouv/dev

2019-04-23-01
This commit is contained in:
LeSim 2019-04-23 15:17:29 +02:00 committed by GitHub
commit 04a2248e4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,10 @@ class ApiAdresse::API
def self.call(address, limit = 1)
search_url = [API_ADRESSE_URL, "search"].join("/")
RestClient.get(search_url, params: { q: address, limit: limit })
RestClient::Request.execute(method: :get,
url: search_url,
timeout: 5,
headers: { params: { q: address, limit: limit } })
rescue RestClient::ServiceUnavailable
nil
end