demarches-normaliennes/app/lib/carto/sgmap/quartiers_prioritaires/adapter.rb

16 lines
426 B
Ruby
Raw Normal View History

class CARTO::SGMAP::QuartiersPrioritaires::Adapter
2015-11-23 18:43:07 +01:00
def initialize(coordinates)
@coordinates = GeojsonService.to_json_polygon_for_qp(coordinates)
2015-11-23 18:43:07 +01:00
end
def data_source
@data_source ||= JSON.parse(CARTO::SGMAP::API.search_qp(@coordinates), symbolize_names: true)
2015-11-23 18:43:07 +01:00
end
def to_params
data_source[:features].map do |feature|
feature[:properties].merge({ geometry: feature[:geometry] })
2015-11-23 18:43:07 +01:00
end
end
end