CARTO::SGMAP → ApiCarto
This commit is contained in:
parent
442b4a241b
commit
d726fbf698
8 changed files with 13 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
||||||
class CARTO::SGMAP::API
|
class ApiCarto::API
|
||||||
def initialize
|
def initialize
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
class CARTO::SGMAP::Cadastre::Adapter
|
class ApiCarto::Cadastre::Adapter
|
||||||
def initialize(coordinates)
|
def initialize(coordinates)
|
||||||
@coordinates = GeojsonService.to_json_polygon_for_cadastre(coordinates)
|
@coordinates = GeojsonService.to_json_polygon_for_cadastre(coordinates)
|
||||||
end
|
end
|
||||||
|
|
||||||
def data_source
|
def data_source
|
||||||
@data_source ||= JSON.parse(CARTO::SGMAP::API.search_cadastre(@coordinates), symbolize_names: true)
|
@data_source ||= JSON.parse(ApiCarto::API.search_cadastre(@coordinates), symbolize_names: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def results
|
def results
|
|
@ -1,10 +1,10 @@
|
||||||
class CARTO::SGMAP::QuartiersPrioritaires::Adapter
|
class ApiCarto::QuartiersPrioritaires::Adapter
|
||||||
def initialize(coordinates)
|
def initialize(coordinates)
|
||||||
@coordinates = GeojsonService.to_json_polygon_for_qp(coordinates)
|
@coordinates = GeojsonService.to_json_polygon_for_qp(coordinates)
|
||||||
end
|
end
|
||||||
|
|
||||||
def data_source
|
def data_source
|
||||||
@data_source ||= JSON.parse(CARTO::SGMAP::API.search_qp(@coordinates), symbolize_names: true)
|
@data_source ||= JSON.parse(ApiCarto::API.search_qp(@coordinates), symbolize_names: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def results
|
def results
|
|
@ -25,7 +25,7 @@ class ModuleApiCartoService
|
||||||
|
|
||||||
def self.generate_qp(coordinates)
|
def self.generate_qp(coordinates)
|
||||||
coordinates.flat_map do |coordinate|
|
coordinates.flat_map do |coordinate|
|
||||||
CARTO::SGMAP::QuartiersPrioritaires::Adapter.new(
|
ApiCarto::QuartiersPrioritaires::Adapter.new(
|
||||||
coordinate.map { |element| [element['lng'], element['lat']] }
|
coordinate.map { |element| [element['lng'], element['lat']] }
|
||||||
).results
|
).results
|
||||||
end
|
end
|
||||||
|
@ -33,7 +33,7 @@ class ModuleApiCartoService
|
||||||
|
|
||||||
def self.generate_cadastre(coordinates)
|
def self.generate_cadastre(coordinates)
|
||||||
coordinates.flat_map do |coordinate|
|
coordinates.flat_map do |coordinate|
|
||||||
CARTO::SGMAP::Cadastre::Adapter.new(
|
ApiCarto::Cadastre::Adapter.new(
|
||||||
coordinate.map { |element| [element['lng'], element['lat']] }
|
coordinate.map { |element| [element['lng'], element['lat']] }
|
||||||
).results
|
).results
|
||||||
end
|
end
|
||||||
|
|
|
@ -113,7 +113,7 @@ shared_examples 'carte_controller_spec' do
|
||||||
let(:module_api_carto) { create(:module_api_carto, :with_quartiers_prioritaires) }
|
let(:module_api_carto) { create(:module_api_carto, :with_quartiers_prioritaires) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(CARTO::SGMAP::QuartiersPrioritaires::Adapter)
|
allow_any_instance_of(ApiCarto::QuartiersPrioritaires::Adapter)
|
||||||
.to receive(:results)
|
.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]]]] } }])
|
.and_return([{ :code => "QPCODE1234", :nom => "QP de test", :commune => "Paris", :geometry => { :type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } }])
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ shared_examples 'carte_controller_spec' do
|
||||||
let(:module_api_carto) { create(:module_api_carto, :with_cadastre) }
|
let(:module_api_carto) { create(:module_api_carto, :with_cadastre) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(CARTO::SGMAP::Cadastre::Adapter)
|
allow_any_instance_of(ApiCarto::Cadastre::Adapter)
|
||||||
.to receive(:results)
|
.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]]]] } }])
|
.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]]]] } }])
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ shared_examples 'carte_controller_spec' do
|
||||||
render_views
|
render_views
|
||||||
|
|
||||||
before do
|
before do
|
||||||
allow_any_instance_of(CARTO::SGMAP::QuartiersPrioritaires::Adapter)
|
allow_any_instance_of(ApiCarto::QuartiersPrioritaires::Adapter)
|
||||||
.to receive(:results)
|
.to receive(:results)
|
||||||
.and_return([{ :code => "QPCODE1234", :geometry => { :type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } }])
|
.and_return([{ :code => "QPCODE1234", :geometry => { :type => "MultiPolygon", :coordinates => [[[[2.38715792094576, 48.8723062632126], [2.38724851642619, 48.8721392348061]]]] } }])
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe CARTO::SGMAP::API do
|
describe ApiCarto::API do
|
||||||
describe '.search_qp' do
|
describe '.search_qp' do
|
||||||
subject { described_class.search_qp(geojson) }
|
subject { described_class.search_qp(geojson) }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe CARTO::SGMAP::Cadastre::Adapter do
|
describe ApiCarto::Cadastre::Adapter do
|
||||||
subject { described_class.new(coordinates).results }
|
subject { described_class.new(coordinates).results }
|
||||||
|
|
||||||
before do
|
before do
|
|
@ -1,6 +1,6 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe CARTO::SGMAP::QuartiersPrioritaires::Adapter do
|
describe ApiCarto::QuartiersPrioritaires::Adapter do
|
||||||
subject { described_class.new(coordinates).results }
|
subject { described_class.new(coordinates).results }
|
||||||
|
|
||||||
before do
|
before do
|
Loading…
Reference in a new issue