Mutualise mandatory_params call

This commit is contained in:
gregoirenovel 2018-03-15 13:55:54 +01:00
parent 9daf0ee608
commit 6902f502d3

View file

@ -8,25 +8,26 @@ class SIADE::API
def self.entreprise(siren, procedure_id)
endpoint = "/v2/entreprises/#{siren}"
call(base_url + endpoint, mandatory_params(siren, procedure_id))
call(base_url + endpoint, siren, procedure_id)
end
def self.etablissement(siret, procedure_id)
endpoint = "/v2/etablissements/#{siret}"
call(base_url + endpoint, mandatory_params(siret, procedure_id))
call(base_url + endpoint, siret, procedure_id)
end
def self.exercices(siret, procedure_id)
endpoint = "/v2/exercices/#{siret}"
call(base_url + endpoint, mandatory_params(siret, procedure_id))
call(base_url + endpoint, siret, procedure_id)
end
def self.rna(siret, procedure_id)
endpoint = "/v2/associations/#{siret}"
call(base_url + endpoint, mandatory_params(siret, procedure_id))
call(base_url + endpoint, siret, procedure_id)
end
def self.call(url, params)
def self.call(url, siret_or_siren, procedure_id)
params = mandatory_params(siret_or_siren, procedure_id)
params[:token] = SIADETOKEN
verify_ssl_mode = OpenSSL::SSL::VERIFY_NONE