prepare cohabitation of multiple versions of api entreprise
This commit is contained in:
parent
47f1e27f85
commit
9a38ec1184
2 changed files with 13 additions and 13 deletions
|
@ -1,14 +1,14 @@
|
||||||
class APIEntreprise::API
|
class APIEntreprise::API
|
||||||
ENTREPRISE_RESOURCE_NAME = "entreprises"
|
ENTREPRISE_RESOURCE_NAME = "v2/entreprises/%{id}"
|
||||||
ETABLISSEMENT_RESOURCE_NAME = "etablissements"
|
ETABLISSEMENT_RESOURCE_NAME = "v2/etablissements/%{id}"
|
||||||
EXERCICES_RESOURCE_NAME = "exercices"
|
EXERCICES_RESOURCE_NAME = "v2/exercices/%{id}"
|
||||||
RNA_RESOURCE_NAME = "associations"
|
RNA_RESOURCE_NAME = "v2/associations/%{id}"
|
||||||
EFFECTIFS_RESOURCE_NAME = "effectifs_mensuels_acoss_covid"
|
EFFECTIFS_RESOURCE_NAME = "v2/effectifs_mensuels_acoss_covid"
|
||||||
EFFECTIFS_ANNUELS_RESOURCE_NAME = "effectifs_annuels_acoss_covid"
|
EFFECTIFS_ANNUELS_RESOURCE_NAME = "v2/effectifs_annuels_acoss_covid/%{id}"
|
||||||
ATTESTATION_SOCIALE_RESOURCE_NAME = "attestations_sociales_acoss"
|
ATTESTATION_SOCIALE_RESOURCE_NAME = "v2/attestations_sociales_acoss/%{id}"
|
||||||
ATTESTATION_FISCALE_RESOURCE_NAME = "attestations_fiscales_dgfip"
|
ATTESTATION_FISCALE_RESOURCE_NAME = "v2/attestations_fiscales_dgfip/%{id}"
|
||||||
BILANS_BDF_RESOURCE_NAME = "bilans_entreprises_bdf"
|
BILANS_BDF_RESOURCE_NAME = "v2/bilans_entreprises_bdf/%{id}"
|
||||||
PRIVILEGES_RESOURCE_NAME = "privileges"
|
PRIVILEGES_RESOURCE_NAME = "v2/privileges"
|
||||||
|
|
||||||
TIMEOUT = 20
|
TIMEOUT = 20
|
||||||
DEFAULT_API_ENTREPRISE_DELAY = 0.0
|
DEFAULT_API_ENTREPRISE_DELAY = 0.0
|
||||||
|
@ -41,7 +41,7 @@ class APIEntreprise::API
|
||||||
end
|
end
|
||||||
|
|
||||||
def effectifs(siren, annee, mois)
|
def effectifs(siren, annee, mois)
|
||||||
endpoint = [EFFECTIFS_RESOURCE_NAME, annee, mois, "entreprise"].join('/')
|
endpoint = [EFFECTIFS_RESOURCE_NAME, annee, mois, "entreprise", "%{id}"].join('/')
|
||||||
call_with_siret(endpoint, siren)
|
call_with_siret(endpoint, siren)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ class APIEntreprise::API
|
||||||
end
|
end
|
||||||
|
|
||||||
def make_url(resource_name, siret_or_siren = nil)
|
def make_url(resource_name, siret_or_siren = nil)
|
||||||
[API_ENTREPRISE_URL, resource_name, siret_or_siren].compact.join("/")
|
[API_ENTREPRISE_URL, format(resource_name, id: siret_or_siren)].compact.join("/")
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_params(user_id)
|
def build_params(user_id)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# rubocop:disable DS/ApplicationName
|
# rubocop:disable DS/ApplicationName
|
||||||
# API URLs
|
# API URLs
|
||||||
API_ADRESSE_URL = ENV.fetch("API_ADRESSE_URL", "https://api-adresse.data.gouv.fr")
|
API_ADRESSE_URL = ENV.fetch("API_ADRESSE_URL", "https://api-adresse.data.gouv.fr")
|
||||||
API_ENTREPRISE_URL = ENV.fetch("API_ENTREPRISE_URL", "https://entreprise.api.gouv.fr/v2")
|
API_ENTREPRISE_URL = ENV.fetch("API_ENTREPRISE_URL", "https://entreprise.api.gouv.fr")
|
||||||
API_EDUCATION_URL = ENV.fetch("API_EDUCATION_URL", "https://data.education.gouv.fr/api/records/1.0")
|
API_EDUCATION_URL = ENV.fetch("API_EDUCATION_URL", "https://data.education.gouv.fr/api/records/1.0")
|
||||||
API_GEO_URL = ENV.fetch("API_GEO_URL", "https://geo.api.gouv.fr")
|
API_GEO_URL = ENV.fetch("API_GEO_URL", "https://geo.api.gouv.fr")
|
||||||
API_PARTICULIER_URL = ENV.fetch("API_PARTICULIER_URL", "https://particulier.api.gouv.fr/api")
|
API_PARTICULIER_URL = ENV.fetch("API_PARTICULIER_URL", "https://particulier.api.gouv.fr/api")
|
||||||
|
|
Loading…
Reference in a new issue