ApiGeo::Driver → ApiGeo::API

This commit is contained in:
gregoirenovel 2018-10-15 21:01:37 +02:00
parent c654122e90
commit 76cf9ab746
5 changed files with 5 additions and 5 deletions

View file

@ -1,4 +1,4 @@
class ApiGeo::Driver
class ApiGeo::API
def self.regions
url = [API_GEO_URL, "regions"].join("/")
call(url)

View file

@ -1,5 +1,5 @@
class Champs::DepartementChamp < Champs::TextChamp
def self.departements
JSON.parse(ApiGeo::Driver.departements).map { |liste| "#{liste['code']} - #{liste['nom']}" }.push('99 - Étranger')
JSON.parse(ApiGeo::API.departements).map { |liste| "#{liste['code']} - #{liste['nom']}" }.push('99 - Étranger')
end
end

View file

@ -1,5 +1,5 @@
class Champs::PaysChamp < Champs::TextChamp
def self.pays
JSON.parse(ApiGeo::Driver.pays).pluck("nom")
JSON.parse(ApiGeo::API.pays).pluck("nom")
end
end

View file

@ -1,5 +1,5 @@
class Champs::RegionChamp < Champs::TextChamp
def self.regions
JSON.parse(ApiGeo::Driver.regions).sort_by { |e| e['nom'] }.pluck("nom")
JSON.parse(ApiGeo::API.regions).sort_by { |e| e['nom'] }.pluck("nom")
end
end

View file

@ -1,6 +1,6 @@
require 'spec_helper'
describe ApiGeo::Driver do
describe ApiGeo::API do
describe '.regions', vcr: { cassette_name: 'api_geo_regions' } do
subject { described_class.regions }