feat(api_geo): add api_geo service

This commit is contained in:
Paul Chavard 2022-12-20 21:27:52 +01:00
parent 69f964e4a3
commit 4d4c378724
7 changed files with 880 additions and 36 deletions

View file

@ -1,20 +0,0 @@
class API::PaysController < ApplicationController
before_action :authenticate_logged_user!
def index
countries = CountriesService.get('FR').zip(CountriesService.get(I18n.locale))
countries = countries.map do |(code, value_fr), (localized_code, localized_value)|
if code != localized_code
raise "Countries lists mismatch. It means i18n_data gem has some internal inconsistencies."
end
{
code: code,
value: value_fr,
label: localized_value
}
end
render json: countries
end
end

View file

@ -0,0 +1,77 @@
class APIGeoService
class << self
def countries(locale: I18n.locale)
I18nData.countries(locale)
.merge(get_localized_additional_countries(locale))
.map { |(code, name)| { name:, code: } }
.sort_by { I18n.transliterate(_1[:name]) }
end
def country_name(code, locale: I18n.locale)
countries(locale:).find { _1[:code] == code }&.dig(:name)
end
def country_code(name)
return if name.nil?
code = I18nData.country_code(name) || I18nData.country_code(name.humanize) || I18nData.country_code(name.titleize)
if code.nil?
countries_index_fr[I18n.transliterate(name).upcase]&.dig(:code)
else
code
end
end
def regions
get_from_api_geo(:regions).sort_by { I18n.transliterate(_1[:name]) }
end
def region_name(code)
regions.find { _1[:code] == code }&.dig(:name)
end
def region_code(name)
return if name.nil?
regions.find { _1[:name] == name }&.dig(:code)
end
def departements
[{ code: '99', name: 'Etranger' }] + get_from_api_geo(:departements).sort_by { _1[:code] }
end
def departement_name(code)
departements.find { _1[:code] == code }&.dig(:name)
end
def departement_code(name)
return if name.nil?
departements.find { _1[:name] == name }&.dig(:code)
end
private
def get_from_api_geo(scope)
Rails.cache.fetch("api_geo_#{scope}", expires_in: 1.year) do
response = Typhoeus.get("#{API_GEO_URL}/#{scope}")
JSON.parse(response.body).map(&:symbolize_keys)
.map { { name: _1[:nom].tr("'", ''), code: _1[:code] } }
end
end
def countries_index_fr
Rails.cache.fetch('countries_index_fr', expires_in: 1.year) do
countries(locale: 'FR').index_by { I18n.transliterate(_1[:name]).upcase }
end
end
def get_localized_additional_countries(locale)
additional_countries[locale.to_s.upcase] || {}
end
def additional_countries
{
'FR' => { 'XK' => 'Kosovo' },
'EN' => { 'XK' => 'Kosovo' }
}
end
end
end

View file

@ -1,16 +0,0 @@
class CountriesService
def self.get(locale)
I18nData.countries(locale).merge(get_localized_additional_countries(locale))
end
def self.get_localized_additional_countries(locale)
additional_countries[locale.to_s.upcase] || {}
end
def self.additional_countries
{
'FR' => { 'XK' => 'Kosovo' },
'EN' => { 'XK' => 'Kosovo' }
}
end
end

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,41 @@
---
http_interactions:
- request:
method: get
uri: https://geo.api.gouv.fr/regions
body:
encoding: US-ASCII
string: ''
headers:
User-Agent:
- demarches-simplifiees.fr
Expect:
- ''
response:
status:
code: 200
message: ''
headers:
Server:
- nginx/1.10.3 (Ubuntu)
Date:
- Tue, 20 Dec 2022 11:55:45 GMT
Content-Type:
- application/json; charset=utf-8
Content-Length:
- '653'
Vary:
- Accept-Encoding
- Origin
X-Powered-By:
- Express
Etag:
- W/"28d-NqjRJu+ph9X/ycpx3D2pjeoeVto"
Strict-Transport-Security:
- max-age=15552000
body:
encoding: ASCII-8BIT
string: !binary |-
W3sibm9tIjoiw45sZS1kZS1GcmFuY2UiLCJjb2RlIjoiMTEifSx7Im5vbSI6IkNlbnRyZS1WYWwgZGUgTG9pcmUiLCJjb2RlIjoiMjQifSx7Im5vbSI6IkJvdXJnb2duZS1GcmFuY2hlLUNvbXTDqSIsImNvZGUiOiIyNyJ9LHsibm9tIjoiTm9ybWFuZGllIiwiY29kZSI6IjI4In0seyJub20iOiJIYXV0cy1kZS1GcmFuY2UiLCJjb2RlIjoiMzIifSx7Im5vbSI6IkdyYW5kIEVzdCIsImNvZGUiOiI0NCJ9LHsibm9tIjoiUGF5cyBkZSBsYSBMb2lyZSIsImNvZGUiOiI1MiJ9LHsibm9tIjoiQnJldGFnbmUiLCJjb2RlIjoiNTMifSx7Im5vbSI6Ik5vdXZlbGxlLUFxdWl0YWluZSIsImNvZGUiOiI3NSJ9LHsibm9tIjoiT2NjaXRhbmllIiwiY29kZSI6Ijc2In0seyJub20iOiJBdXZlcmduZS1SaMO0bmUtQWxwZXMiLCJjb2RlIjoiODQifSx7Im5vbSI6IlByb3ZlbmNlLUFscGVzLUPDtHRlIGQnQXp1ciIsImNvZGUiOiI5MyJ9LHsibm9tIjoiQ29yc2UiLCJjb2RlIjoiOTQifSx7Im5vbSI6Ikd1YWRlbG91cGUiLCJjb2RlIjoiMDEifSx7Im5vbSI6Ik1hcnRpbmlxdWUiLCJjb2RlIjoiMDIifSx7Im5vbSI6Ikd1eWFuZSIsImNvZGUiOiIwMyJ9LHsibm9tIjoiTGEgUsOpdW5pb24iLCJjb2RlIjoiMDQifSx7Im5vbSI6Ik1heW90dGUiLCJjb2RlIjoiMDYifV0=
recorded_at: Tue, 20 Dec 2022 11:55:45 GMT
recorded_with: VCR 6.1.0

676
spec/fixtures/files/pays_dump.json vendored Normal file
View file

@ -0,0 +1,676 @@
[
"ACORES, MADERE",
"Afghanistan",
"AFGHANISTAN",
"Afrique du Sud",
"AFRIQUE DU SUD",
"Åland, Îles",
"ALASKA",
"Albania",
"Albanie",
"ALBANIE",
"Algeria",
"ALGERIE",
"Algérie",
"Allemagne",
"ALLEMAGNE",
"American Samoa",
"Andorra",
"Andorre",
"ANDORRE",
"Angola",
"ANGOLA",
"Anguilla",
"ANGUILLA",
"Antarctique",
"Antigua and Barbuda",
"Antigua-et-Barbuda",
"ANTIGUA-ET-BARBUDA",
"ANTILLES NEERLANDAISES",
"Arabie saoudite",
"ARABIE SAOUDITE",
"Argentina",
"Argentine",
"ARGENTINE",
"Armenia",
"ARMENIE",
"Arménie",
"Aruba",
"ARUBA",
"Australia",
"Australie",
"AUSTRALIE",
"Austria",
"Autriche",
"AUTRICHE",
"AZERBAIDJAN",
"Azerbaïdjan",
"Azerbaijan",
"Bahamas",
"BAHAMAS",
"Bahrain",
"BAHREIN",
"Bahreïn",
"Bangladesh",
"BANGLADESH",
"Barbade",
"BARBADE",
"Barbados",
"Belarus",
"Bélarus",
"Belgique",
"BELGIQUE",
"Belgium",
"Belize",
"BELIZE",
"Benin",
"BENIN",
"Bénin",
"Bermuda",
"Bermudes",
"BERMUDES",
"Bhoutan",
"BHOUTAN",
"Bhutan",
"BIELORUSSIE",
"Birmanie",
"BIRMANIE",
"Bolivia",
"Bolivie",
"BOLIVIE",
"BONAIRE, SAINT EUSTACHE ET SABA",
"Bonaire, Saint-Eustache et Saba",
"Bonaire, Sint Eustatius and Saba",
"Bosnia and Herzegovina",
"BOSNIE-HERZEGOVINE",
"Bosnie-Herzégovine",
"Botswana",
"BOTSWANA",
"Brazil",
"BRESIL",
"Brésil",
"British Indian Ocean Territory",
"Brunei Darussalam",
"Brunéi Darussalam",
"BRUNEI",
"Bulgaria",
"Bulgarie",
"BULGARIE",
"Burkina Faso",
"BURKINA",
"Burundi",
"BURUNDI",
"Cabo Verde",
"CAIMANES (ILES)",
"Cambodge",
"CAMBODGE",
"Cambodia",
"Cameroon",
"CAMEROUN ET TOGO",
"Cameroun",
"CAMEROUN",
"Canada",
"CANADA",
"CANARIES (ILES)",
"Cap-Vert",
"CAP-VERT",
"Cayman Islands",
"CENTRAFRICAINE (REPUBLIQUE)",
"Central African Republic",
"Chad",
"Chile",
"Chili",
"CHILI",
"China",
"Chine",
"CHINE",
"CHRISTMAS (ILE)",
"Christmas, Île",
"Chypre",
"CHYPRE",
"Cocos (Keeling) Islands",
"Cocos (Keeling), Îles",
"Colombia",
"Colombie",
"COLOMBIE",
"Comores",
"COMORES",
"Comoros",
"CONGO (REPUBLIQUE DEMOCRATIQUE)",
"Congo, The Democratic Republic of the",
"Congo",
"CONGO",
"COOK (ILES)",
"COREE (REPUBLIQUE DE)",
"COREE (REPUBLIQUE POPULAIRE DEMOCRATIQUE DE)",
"Corée, République de",
"Corée, République populaire démocratique de",
"COREE",
"Costa Rica",
"COSTA RICA",
"COTE D'IVOIRE",
"Côte d'Ivoire",
"Croatia",
"Croatie",
"CROATIE",
"Cuba",
"CUBA",
"Curaçao",
"CURAÇAO",
"Cyprus",
"Czechia",
"Danemark",
"DANEMARK",
"Denmark",
"Djibouti",
"DJIBOUTI",
"Dominica",
"DOMINICAINE (REPUBLIQUE)",
"Dominican Republic",
"Dominique",
"DOMINIQUE",
"Ecuador",
"Egypt",
"EGYPTE",
"Égypte",
"El Salvador",
"EL SALVADOR",
"EMIRATS ARABES UNIS",
"Émirats arabes unis",
"EQUATEUR",
"Équateur",
"Equatorial Guinea",
"Eritrea",
"ERYTHREE",
"Érythrée",
"Espagne",
"ESPAGNE",
"Estonia",
"Estonie",
"ESTONIE",
"Eswatini",
"ETATS MALAIS NON FEDERES",
"ETATS-UNIS",
"États-Unis",
"Ethiopia",
"ETHIOPIE",
"Éthiopie",
"Falkland Islands (Malvinas)",
"FEROE (ILES)",
"Fidji",
"FIDJI",
"Fiji",
"Finland",
"Finlande",
"FINLANDE",
"France",
"FRANCE",
"French Guiana",
"French Polynesia",
"French Southern Territories",
"Gabon",
"GABON",
"Gambia",
"Gambie",
"GAMBIE",
"Georgia",
"GEORGIE DU SUD ET LES ILES SANDWICH DU SUD",
"Géorgie du Sud et les îles Sandwich du Sud",
"GEORGIE",
"Géorgie",
"Germany",
"Ghana",
"GHANA",
"Gibraltar",
"GIBRALTAR",
"GRECE",
"Grèce",
"Greece",
"Grenada",
"Grenade",
"GRENADE",
"GROENLAND",
"Groënland",
"Guadeloupe",
"GUADELOUPE",
"Guam",
"GUAM",
"Guatemala",
"GUATEMALA",
"Guernesey",
"GUERNESEY",
"Guernsey",
"Guinea",
"GUINEE EQUATORIALE",
"Guinée Équatoriale",
"GUINEE-BISSAU",
"Guinée-Bissau",
"GUINEE",
"Guinée",
"Guyana",
"GUYANA",
"Guyane française",
"GUYANE",
"Haiti",
"HAITI",
"Haïti",
"HAWAII (ILES)",
"HEARD ET MACDONALD (ILES)",
"Holy See (Vatican City State)",
"Honduras",
"HONDURAS",
"Hong Kong",
"HONG-KONG",
"Hongrie",
"HONGRIE",
"Hungary",
"Iceland",
"île Bouvet",
"Île de Man",
"île Norfolk",
"îles Caïmans",
"îles Cook",
"îles Féroé",
"îles Heard-et-MacDonald",
"Îles Mariannes du Nord",
"Îles Marshall",
"Îles mineures éloignées des États-Unis",
"Îles Pitcairn",
"ILES PORTUGAISES DE L'OCEAN INDIEN",
"îles Turques-et-Caïques",
"Îles Vierges britanniques",
"Îles Vierges des États-Unis",
"Inde",
"INDE",
"India",
"Indonesia",
"INDONESIE",
"Indonésie",
"Irak",
"Iran, Islamic Republic of",
"Iran, République islamique d'",
"IRAN",
"Iraq",
"IRAQ",
"Ireland",
"IRLANDE, ou EIRE",
"Irlande",
"Islande",
"ISLANDE",
"Isle of Man",
"Israel",
"ISRAEL",
"Israël",
"Italie",
"ITALIE",
"Italy",
"Jamaica",
"JAMAIQUE",
"Jamaïque",
"Japan",
"Japon",
"JAPON",
"Jersey",
"JERSEY",
"Jordan",
"Jordanie",
"JORDANIE",
"KAMTCHATKA",
"Kazakhstan",
"KAZAKHSTAN",
"Kenya",
"KENYA",
"Kirghizistan",
"KIRGHIZISTAN",
"Korea, Democratic People's Republic of",
"Korea, Republic of",
"Kosovo",
"KOSOVO",
"KOWEIT",
"Koweït",
"Kuwait",
"Kyrgyzstan",
"LA REUNION",
"LABRADOR",
"Lao People's Democratic Republic",
"Lao, République démocratique populaire",
"LAOS",
"Latvia",
"Lebanon",
"Lesotho",
"LESOTHO",
"Lettonie",
"LETTONIE",
"Liban",
"LIBAN",
"Liberia",
"LIBERIA",
"Libéria",
"Libya",
"Libye",
"LIBYE",
"Liechtenstein",
"LIECHTENSTEIN",
"Lithuania",
"Lituanie",
"LITUANIE",
"Luxembourg",
"LUXEMBOURG",
"Macao",
"MACAO",
"Macau",
"MACEDOINE DU NORD (REPUBLIQUE DE)",
"Macédoine du Nord",
"Madagascar",
"MADAGASCAR",
"Malaisie",
"MALAISIE",
"Malawi",
"MALAWI",
"Malaysia",
"Maldives",
"MALDIVES",
"Mali",
"MALI",
"Malouines, Îles (Falkland)",
"MALOUINES, OU FALKLAND (ILES)",
"Malta",
"Malte",
"MALTE",
"MAN (ILE)",
"MARIANNES DU NORD (ILES)",
"Maroc",
"MAROC",
"MARSHALL (ILES)",
"Martinique",
"MARTINIQUE",
"Maurice",
"MAURICE",
"Mauritania",
"Mauritanie",
"MAURITANIE",
"Mauritius",
"Mayotte",
"MAYOTTE",
"Mexico",
"Mexique",
"MEXIQUE",
"Micronésie, États fédérés de",
"Moldavie",
"MOLDAVIE",
"Moldova",
"Monaco",
"MONACO",
"Mongolia",
"Mongolie",
"MONGOLIE",
"Montenegro",
"MONTENEGRO",
"Monténégro",
"MONTSERRAT",
"Morocco",
"Mozambique",
"MOZAMBIQUE",
"Myanmar",
"Namibia",
"Namibie",
"NAMIBIE",
"Nepal",
"NEPAL",
"Népal",
"Netherlands",
"New Caledonia",
"New Zealand",
"Nicaragua",
"NICARAGUA",
"Niger",
"NIGER",
"Nigeria",
"NIGERIA",
"North Macedonia",
"NORVEGE",
"Norvège",
"Norway",
"NOUVELLE-CALEDONIE",
"Nouvelle-Calédonie",
"NOUVELLE-ZELANDE",
"Nouvelle-Zélande",
"OCEAN INDIEN (TERRITOIRE BRITANNIQUE DE L')",
"Oman",
"OMAN",
"Ouganda",
"OUGANDA",
"OUZBEKISTAN",
"Ouzbékistan",
"Pakistan",
"PAKISTAN",
"Palaos",
"PALESTINE (Etat de)",
"Palestine, État de",
"Palestine, State of",
"Panama",
"PANAMA",
"PAPOUASIE-NOUVELLE-GUINEE",
"Papouasie-Nouvelle-Guinée",
"Papua New Guinea",
"Paraguay",
"PARAGUAY",
"Pays-Bas",
"PAYS-BAS",
"PEROU",
"Pérou",
"Peru",
"Philippines",
"PHILIPPINES",
"Poland",
"Pologne",
"POLOGNE",
"POLYNESIE FRANCAISE",
"Polynésie française",
"Porto Rico",
"PORTO RICO",
"Portugal",
"PORTUGAL",
"POSSESSIONS BRITANNIQUES AU PROCHE-ORIENT",
"PROVINCES ESPAGNOLES D'AFRIQUE",
"Puerto Rico",
"Qatar",
"QATAR",
"République centrafricaine",
"REPUBLIQUE DEMOCRATIQUE ALLEMANDE",
"République démocratique du Congo",
"République dominicaine",
"République du Congo",
"REPUBLIQUE FEDERALE D'ALLEMAGNE",
"Réunion, Île de la",
"Réunion",
"Romania",
"Roumanie",
"ROUMANIE",
"Royaume-Uni",
"ROYAUME-UNI",
"Russian Federation",
"Russie, Fédération de",
"RUSSIE",
"Rwanda",
"RWANDA",
"Sahara occidental",
"SAHARA OCCIDENTAL",
"Saint Barthélemy",
"Saint Kitts and Nevis",
"Saint Lucia",
"Saint Martin (French part)",
"Saint Pierre and Miquelon",
"Saint Vincent and the Grenadines",
"SAINT-BARTHELEMY",
"Saint-Barthélemy",
"SAINT-CHRISTOPHE-ET-NIEVES",
"Saint-Christophe-et-Niévès",
"Saint-Marin",
"SAINT-MARIN",
"Saint-Martin (partie française)",
"SAINT-MARTIN (PARTIE NEERLANDAISE)",
"Saint-Martin (partie néerlandaise)",
"SAINT-MARTIN",
"Saint-Pierre-et-Miquelon",
"SAINT-PIERRE-ET-MIQUELON",
"Saint-Siège (état de la cité du Vatican)",
"SAINT-VINCENT-ET-LES GRENADINES",
"Saint-Vincent-et-les-Grenadines",
"SAINTE HELENE, ASCENSION ET TRISTAN DA CUNHA",
"Sainte-Hélène, Ascension et Tristan da Cunha",
"Sainte-Lucie",
"SAINTE-LUCIE",
"SALOMON (ILES)",
"Salomon, Îles",
"Salvador",
"SAMOA AMERICAINES",
"Samoa américaines",
"SAMOA OCCIDENTALES",
"Samoa",
"Sao Tome and Principe",
"SAO TOME-ET-PRINCIPE",
"Sao Tomé-et-Principe",
"Saudi Arabia",
"Senegal",
"SENEGAL",
"Sénégal",
"Serbia",
"Serbie",
"SERBIE",
"Seychelles",
"SEYCHELLES",
"SIBERIE",
"Sierra Leone",
"SIERRA LEONE",
"Singapore",
"Singapour",
"SINGAPOUR",
"Sint Maarten (Dutch part)",
"Slovakia",
"Slovaquie",
"SLOVAQUIE",
"Slovenia",
"SLOVENIE",
"Slovénie",
"Somalia",
"Somalie",
"SOMALIE",
"SOUDAN ANGLO-EGYPTIEN, KENYA, OUGANDA",
"Soudan du Sud",
"SOUDAN DU SUD",
"Soudan",
"SOUDAN",
"South Africa",
"South Georgia and the South Sandwich Islands",
"South Sudan",
"Spain",
"Sri Lanka",
"SRI LANKA",
"Sudan",
"SUEDE",
"Suède",
"Suisse",
"SUISSE",
"Surinam",
"Suriname",
"SURINAME",
"Svalbard and Jan Mayen",
"Svalbard et île Jan Mayen",
"SWAZILAND",
"Sweden",
"Switzerland",
"Syrian Arab Republic",
"SYRIE",
"Syrienne, République arabe",
"Tadjikistan",
"TADJIKISTAN",
"Taiwan",
"TAIWAN",
"Taïwan",
"Tajikistan",
"TANGER",
"Tanzania",
"Tanzanie",
"TANZANIE",
"Tchad",
"TCHAD",
"TCHECOSLOVAQUIE",
"TCHEQUE (REPUBLIQUE)",
"Tchéquie",
"TERR. DES ETATS-UNIS D'AMERIQUE EN AMERIQUE",
"TERR. DES ETATS-UNIS D'AMERIQUE EN OCEANIE",
"TERR. DU ROYAUME-UNI DANS L'ATLANTIQUE SUD",
"TERRE-NEUVE",
"TERRES AUSTRALES FRANCAISES",
"Terres australes françaises",
"Territoire britannique de l'océan Indien",
"TERRITOIRES DU ROYAUME-UNI AUX ANTILLES",
"Thailand",
"THAILANDE",
"Thaïlande",
"Timor oriental",
"TIMOR ORIENTAL",
"Timor-Leste",
"Togo",
"TOGO",
"Tonga",
"TONGA",
"Trinidad and Tobago",
"TRINITE-ET-TOBAGO",
"Trinité-et-Tobago",
"Tunisia",
"Tunisie",
"TUNISIE",
"TURKESTAN RUSSE",
"Turkey",
"Turkmenistan",
"TURKMENISTAN",
"Turkménistan",
"Turks and Caicos Islands",
"TURKS ET CAIQUES (ILES)",
"TURQUIE D'EUROPE",
"Turquie",
"TURQUIE",
"Tuvalu",
"TUVALU",
"Uganda",
"Ukraine",
"UKRAINE",
"United Arab Emirates",
"United Kingdom",
"United States Minor Outlying Islands",
"United States",
"Uruguay",
"URUGUAY",
"Uzbekistan",
"Vanuatu",
"VANUATU",
"VATICAN, ou SAINT-SIEGE",
"Venezuela",
"VENEZUELA",
"Vénézuela",
"VIERGES BRITANNIQUES (ILES)",
"VIERGES DES ETATS-UNIS (ILES)",
"VIET NAM DU NORD",
"VIET NAM DU SUD",
"VIET NAM",
"Viêt Nam",
"Vietnam",
"Virgin Islands, British",
"Virgin Islands, U.S.",
"Wallis et Futuna",
"WALLIS-ET-FUTUNA",
"Western Sahara",
"YEMEN (REPUBLIQUE ARABE DU)",
"YEMEN DEMOCRATIQUE",
"Yemen",
"YEMEN",
"Yémen",
"Zambia",
"Zambie",
"ZAMBIE",
"ZANZIBAR",
"Zimbabwe",
"ZIMBABWE"
]

View file

@ -0,0 +1,45 @@
describe APIGeoService do
let(:memory_store) { ActiveSupport::Cache.lookup_store(:memory_store) }
before do
allow(Rails).to receive(:cache).and_return(memory_store)
Rails.cache.clear
end
describe 'pays' do
it 'countrie_code' do
countries = JSON.parse(Rails.root.join('spec/fixtures/files/pays_dump.json').read)
countries_without_code = countries.map { APIGeoService.country_code(_1) }.count(&:nil?)
expect(countries_without_code).to eq(67)
end
describe 'country_name' do
it 'Kosovo' do
expect(APIGeoService.country_code('Kosovo')).to eq('XK')
expect(APIGeoService.country_name('XK')).to eq('Kosovo')
end
it 'Thaïlande' do
expect(APIGeoService.country_code('Thaïlande')).to eq('TH')
expect(APIGeoService.country_name('TH')).to eq('Thaïlande')
end
end
end
describe 'regions', vcr: { cassette_name: 'api_geo_regions' } do
it 'return sorted results' do
expect(APIGeoService.regions.size).to eq(18)
expect(APIGeoService.regions.first).to eq(code: '84', name: 'Auvergne-Rhône-Alpes')
expect(APIGeoService.regions.last).to eq(code: '93', name: 'Provence-Alpes-Côte dAzur')
end
end
describe 'departements', vcr: { cassette_name: 'api_geo_departements' } do
it 'return sorted results' do
expect(APIGeoService.departements.size).to eq(102)
expect(APIGeoService.departements.first).to eq(code: '99', name: 'Etranger')
expect(APIGeoService.departements.second).to eq(code: '01', name: 'Ain')
expect(APIGeoService.departements.last).to eq(code: '976', name: 'Mayotte')
end
end
end