2018-10-15 16:54:38 +02:00
|
|
|
class ApiCarto::API
|
2015-11-23 18:41:24 +01:00
|
|
|
def self.search_qp(geojson)
|
2018-05-22 17:38:33 +02:00
|
|
|
url = [API_CARTO_URL, "quartiers-prioritaires", "search"].join("/")
|
2018-10-15 15:48:46 +02:00
|
|
|
call(url, geojson)
|
2015-11-23 18:41:24 +01:00
|
|
|
end
|
|
|
|
|
2016-01-12 17:24:42 +01:00
|
|
|
def self.search_cadastre(geojson)
|
2018-05-22 17:38:33 +02:00
|
|
|
url = [API_CARTO_URL, "cadastre", "geometrie"].join("/")
|
2018-10-15 15:48:46 +02:00
|
|
|
call(url, geojson)
|
2016-01-12 17:24:42 +01:00
|
|
|
end
|
|
|
|
|
2015-11-23 18:41:24 +01:00
|
|
|
private
|
|
|
|
|
2018-10-15 15:48:46 +02:00
|
|
|
def self.call(url, geojson)
|
|
|
|
params = geojson.to_s
|
2015-11-23 18:41:24 +01:00
|
|
|
|
2018-10-15 23:52:58 +02:00
|
|
|
RestClient.post(url, params, content_type: 'application/json')
|
2016-12-20 12:27:53 +01:00
|
|
|
|
|
|
|
rescue RestClient::InternalServerError
|
|
|
|
raise RestClient::ResourceNotFound
|
2015-11-23 18:41:24 +01:00
|
|
|
end
|
|
|
|
end
|