2018-10-15 17:35:44 +02:00
|
|
|
class ApiAdresse::API
|
2018-10-15 18:23:32 +02:00
|
|
|
def self.call(address, limit = 1)
|
2018-10-15 17:35:44 +02:00
|
|
|
search_url = [API_ADRESSE_URL, "search"].join("/")
|
|
|
|
|
2018-10-15 18:23:32 +02:00
|
|
|
RestClient.get(search_url, params: { q: address, limit: limit })
|
2018-10-15 17:35:44 +02:00
|
|
|
rescue RestClient::ServiceUnavailable
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|