Add API_GEO_URL
This commit is contained in:
parent
1839269dd9
commit
a246181afd
3 changed files with 6 additions and 22 deletions
|
@ -2,25 +2,19 @@ module Carto
|
||||||
module GeoAPI
|
module GeoAPI
|
||||||
class Driver
|
class Driver
|
||||||
def self.regions
|
def self.regions
|
||||||
call regions_url
|
url = [API_GEO_URL, "regions"].join("/")
|
||||||
|
call url
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.departements
|
def self.departements
|
||||||
call departements_url
|
url = [API_GEO_URL, "departements"].join("/")
|
||||||
|
call url
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.pays
|
def self.pays
|
||||||
File.open('app/lib/carto/geo_api/pays.json').read
|
File.open('app/lib/carto/geo_api/pays.json').read
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.departements_url
|
|
||||||
'https://geo.api.gouv.fr/departements'
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.regions_url
|
|
||||||
'https://geo.api.gouv.fr/regions'
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def self.call(api_url)
|
def self.call(api_url)
|
||||||
|
|
|
@ -2,6 +2,8 @@ API_CARTO_URL = "https://apicarto.sgmap.fr"
|
||||||
|
|
||||||
API_ENTREPRISE_URL = 'https://entreprise.api.gouv.fr/v2'
|
API_ENTREPRISE_URL = 'https://entreprise.api.gouv.fr/v2'
|
||||||
|
|
||||||
|
API_GEO_URL = "https://geo.api.gouv.fr"
|
||||||
|
|
||||||
PIPEDRIVE_API_URL = 'https://api.pipedrive.com/v1'
|
PIPEDRIVE_API_URL = 'https://api.pipedrive.com/v1'
|
||||||
|
|
||||||
DOC_URL = "https://doc.demarches-simplifiees.fr"
|
DOC_URL = "https://doc.demarches-simplifiees.fr"
|
||||||
|
|
|
@ -18,16 +18,4 @@ describe Carto::GeoAPI::Driver do
|
||||||
|
|
||||||
it { is_expected.to eq File.open('app/lib/carto/geo_api/pays.json').read }
|
it { is_expected.to eq File.open('app/lib/carto/geo_api/pays.json').read }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '.departements_url' do
|
|
||||||
subject { described_class.departements_url }
|
|
||||||
|
|
||||||
it { is_expected.to eq 'https://geo.api.gouv.fr/departements' }
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '.regions_url' do
|
|
||||||
subject { described_class.regions_url }
|
|
||||||
|
|
||||||
it { is_expected.to eq 'https://geo.api.gouv.fr/regions' }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue