Merge pull request #3138 from betagouv/api-v3

Api v3
This commit is contained in:
gregoirenovel 2018-12-10 10:54:26 +01:00 committed by GitHub
commit f7c65e8b57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,6 +22,8 @@ class ApiEntreprise::API
call(RNA_RESOURCE_NAME, siret, procedure_id) call(RNA_RESOURCE_NAME, siret, procedure_id)
end end
private
def self.call(resource_name, siret_or_siren, procedure_id) def self.call(resource_name, siret_or_siren, procedure_id)
url = url(resource_name, siret_or_siren) url = url(resource_name, siret_or_siren)
params = params(siret_or_siren, procedure_id) params = params(siret_or_siren, procedure_id)
@ -38,7 +40,9 @@ class ApiEntreprise::API
end end
def self.url(resource_name, siret_or_siren) def self.url(resource_name, siret_or_siren)
[API_ENTREPRISE_URL, resource_name, siret_or_siren].join("/") base_url = [API_ENTREPRISE_URL, resource_name, siret_or_siren].join("/")
"#{base_url}?with_insee_v3=true"
end end
def self.params(siret_or_siren, procedure_id) def self.params(siret_or_siren, procedure_id)
@ -50,8 +54,6 @@ class ApiEntreprise::API
} }
end end
private
def self.token def self.token
Rails.application.secrets.api_entreprise[:key] Rails.application.secrets.api_entreprise[:key]
end end