This commit is contained in:
parent
ac2cc1e5f4
commit
34ac68b27f
6 changed files with 9 additions and 9 deletions
|
@ -7,7 +7,7 @@ class CARTO::SGMAP::Cadastre::Adapter
|
|||
@data_source ||= JSON.parse(CARTO::SGMAP::API.search_cadastre(@coordinates), symbolize_names: true)
|
||||
end
|
||||
|
||||
def to_params
|
||||
def results
|
||||
data_source[:features].map do |feature|
|
||||
filter_properties(feature[:properties]).merge({ geometry: feature[:geometry] })
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ class CARTO::SGMAP::QuartiersPrioritaires::Adapter
|
|||
@data_source ||= JSON.parse(CARTO::SGMAP::API.search_qp(@coordinates), symbolize_names: true)
|
||||
end
|
||||
|
||||
def to_params
|
||||
def results
|
||||
data_source[:features].map do |feature|
|
||||
feature[:properties].merge({ geometry: feature[:geometry] })
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ class ModuleApiCartoService
|
|||
coordinates.flat_map do |coordinate|
|
||||
CARTO::SGMAP::QuartiersPrioritaires::Adapter.new(
|
||||
coordinate.map { |element| [element['lng'], element['lat']] }
|
||||
).to_params
|
||||
).results
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -35,7 +35,7 @@ class ModuleApiCartoService
|
|||
coordinates.flat_map do |coordinate|
|
||||
CARTO::SGMAP::Cadastre::Adapter.new(
|
||||
coordinate.map { |element| [element['lng'], element['lat']] }
|
||||
).to_params
|
||||
).results
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -114,7 +114,7 @@ shared_examples 'carte_controller_spec' do
|
|||
|
||||
before do
|
||||
allow_any_instance_of(CARTO::SGMAP::QuartiersPrioritaires::Adapter)
|
||||
.to receive(:to_params)
|
||||
.to receive(:results)
|
||||
.and_return([{ :code => "QPCODE1234", :nom => "QP de test", :commune => "Paris", :geometry => { :type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } }])
|
||||
|
||||
post :save, params: { dossier_id: dossier.id, selection: json_latlngs }
|
||||
|
@ -161,7 +161,7 @@ shared_examples 'carte_controller_spec' do
|
|||
|
||||
before do
|
||||
allow_any_instance_of(CARTO::SGMAP::Cadastre::Adapter)
|
||||
.to receive(:to_params)
|
||||
.to receive(:results)
|
||||
.and_return([{ :surface_intersection => "0.0006", :surface_parcelle => 11252.692583090324, :numero => "0013", :feuille => 1, :section => "CD", :code_dep => "30", :nom_com => "Le Grau-du-Roi", :code_com => "133", :code_arr => "000", :geometry => { :type => "MultiPolygon", :coordinates => [[[[4.134084, 43.5209193], [4.1346615, 43.5212035], [4.1346984, 43.521189], [4.135096, 43.5213848], [4.1350839, 43.5214122], [4.1352697, 43.521505], [4.1356278, 43.5211065], [4.1357402, 43.5207188], [4.1350935, 43.5203936], [4.135002, 43.5204366], [4.1346051, 43.5202412], [4.134584, 43.5202472], [4.1345572, 43.5202551], [4.134356, 43.5203137], [4.1342488, 43.5203448], [4.134084, 43.5209193]]]] } }])
|
||||
|
||||
post :save, params: { dossier_id: dossier.id, selection: json_latlngs }
|
||||
|
@ -216,7 +216,7 @@ shared_examples 'carte_controller_spec' do
|
|||
|
||||
before do
|
||||
allow_any_instance_of(CARTO::SGMAP::QuartiersPrioritaires::Adapter)
|
||||
.to receive(:to_params)
|
||||
.to receive(:results)
|
||||
.and_return([{ :code => "QPCODE1234", :geometry => { :type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } }])
|
||||
|
||||
post :zones, params: { dossier_id: dossier.id, selection: json_latlngs.to_json }, format: 'js'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe CARTO::SGMAP::Cadastre::Adapter do
|
||||
subject { described_class.new(coordinates).to_params }
|
||||
subject { described_class.new(coordinates).results }
|
||||
|
||||
before do
|
||||
stub_request(:post, "https://apicarto.sgmap.fr/cadastre/geometrie")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe CARTO::SGMAP::QuartiersPrioritaires::Adapter do
|
||||
subject { described_class.new(coordinates).to_params }
|
||||
subject { described_class.new(coordinates).results }
|
||||
|
||||
before do
|
||||
stub_request(:post, "https://apicarto.sgmap.fr/quartiers-prioritaires/search")
|
||||
|
|
Loading…
Reference in a new issue