Add API_GEO_URL

This commit is contained in:
gregoirenovel 2018-05-22 19:01:04 +02:00
parent 1839269dd9
commit a246181afd
3 changed files with 6 additions and 22 deletions

View file

@ -2,25 +2,19 @@ module Carto
module GeoAPI
class Driver
def self.regions
call regions_url
url = [API_GEO_URL, "regions"].join("/")
call url
end
def self.departements
call departements_url
url = [API_GEO_URL, "departements"].join("/")
call url
end
def self.pays
File.open('app/lib/carto/geo_api/pays.json').read
end
def self.departements_url
'https://geo.api.gouv.fr/departements'
end
def self.regions_url
'https://geo.api.gouv.fr/regions'
end
private
def self.call(api_url)

View file

@ -2,6 +2,8 @@ API_CARTO_URL = "https://apicarto.sgmap.fr"
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'
DOC_URL = "https://doc.demarches-simplifiees.fr"

View file

@ -18,16 +18,4 @@ describe Carto::GeoAPI::Driver do
it { is_expected.to eq File.open('app/lib/carto/geo_api/pays.json').read }
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