2018-10-15 17:16:55 +02:00
|
|
|
class ApiCarto::QuartiersPrioritairesAdapter
|
2015-11-23 18:43:07 +01:00
|
|
|
def initialize(coordinates)
|
2016-01-15 11:53:00 +01:00
|
|
|
@coordinates = GeojsonService.to_json_polygon_for_qp(coordinates)
|
2015-11-23 18:43:07 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def data_source
|
2018-10-15 16:54:38 +02:00
|
|
|
@data_source ||= JSON.parse(ApiCarto::API.search_qp(@coordinates), symbolize_names: true)
|
2015-11-23 18:43:07 +01:00
|
|
|
end
|
|
|
|
|
2018-10-15 16:25:16 +02:00
|
|
|
def results
|
2018-10-15 16:07:15 +02:00
|
|
|
data_source[:features].map do |feature|
|
|
|
|
feature[:properties].merge({ geometry: feature[:geometry] })
|
2015-11-23 18:43:07 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|