demarches-normaliennes/app/lib/api_carto/api.rb
2018-10-16 10:16:44 +02:00

22 lines
505 B
Ruby

class ApiCarto::API
def self.search_qp(geojson)
url = [API_CARTO_URL, "quartiers-prioritaires", "search"].join("/")
call(url, geojson)
end
def self.search_cadastre(geojson)
url = [API_CARTO_URL, "cadastre", "geometrie"].join("/")
call(url, geojson)
end
private
def self.call(url, geojson)
params = geojson.to_s
RestClient.post(url, params, content_type: 'application/json')
rescue RestClient::InternalServerError
raise RestClient::ResourceNotFound
end
end