Simplify CARTO::SGMAP::API
This commit is contained in:
parent
2ed4c1da1c
commit
5df4e3305e
1 changed files with 5 additions and 4 deletions
|
@ -4,23 +4,24 @@ class CARTO::SGMAP::API
|
|||
|
||||
def self.search_qp(geojson)
|
||||
url = [API_CARTO_URL, "quartiers-prioritaires", "search"].join("/")
|
||||
call(url, { geojson: geojson.to_s })
|
||||
call(url, geojson)
|
||||
end
|
||||
|
||||
def self.search_cadastre(geojson)
|
||||
url = [API_CARTO_URL, "cadastre", "geometrie"].join("/")
|
||||
call(url, { geojson: geojson.to_s })
|
||||
call(url, geojson)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def self.call(url, params)
|
||||
def self.call(url, geojson)
|
||||
verify_ssl_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
params = geojson.to_s
|
||||
|
||||
RestClient::Resource.new(
|
||||
url,
|
||||
verify_ssl: verify_ssl_mode
|
||||
).post(params[:geojson], content_type: 'application/json')
|
||||
).post(params, content_type: 'application/json')
|
||||
|
||||
rescue RestClient::InternalServerError
|
||||
raise RestClient::ResourceNotFound
|
||||
|
|
Loading…
Add table
Reference in a new issue