Add lib API SGMAP Cartography Cadastre

Adapt lib API SGMAP Cartography Quartier Prioritaire at the new API architecture
This commit is contained in:
Xavier J 2016-01-12 17:24:42 +01:00
parent 312c1ee7a7
commit d48c600476
11 changed files with 1403 additions and 44 deletions

29
lib/carto/sgmap/api.rb Normal file
View file

@ -0,0 +1,29 @@
class CARTO::SGMAP::API
def initialize
end
def self.search_qp(geojson)
endpoint = "/quartiers-prioritaires/search"
call(base_url + endpoint, {geojson: geojson.to_s})
end
def self.search_cadastre(geojson)
endpoint = "/cadastre/geometrie"
call(base_url + endpoint, {geojson: geojson.to_s})
end
private
def self.call(url, params = {})
verify_ssl_mode = OpenSSL::SSL::VERIFY_NONE
RestClient::Resource.new(
url,
verify_ssl: verify_ssl_mode,
).post params[:geojson], content_type: 'application/json'
end
def self.base_url
'https://apicarto.sgmap.fr'
end
end