2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-05-25 14:46:34 +02:00
|
|
|
class APIEntreprise::ExtraitKbisAdapter < APIEntreprise::Adapter
|
2023-05-26 10:06:01 +02:00
|
|
|
# Doc métier : https://entreprise.api.gouv.fr/catalogue/infogreffe/rcs/extrait
|
|
|
|
# Swagger : https://entreprise.api.gouv.fr/developpeurs/openapi#tag/Informations-generales/paths/~1v3~1infogreffe~1rcs~1unites_legales~1%7Bsiren%7D~1extrait_kbis/get
|
|
|
|
|
2023-05-25 14:46:34 +02:00
|
|
|
private
|
|
|
|
|
|
|
|
def get_resource
|
|
|
|
api(@procedure_id).extrait_kbis(siren)
|
|
|
|
end
|
|
|
|
|
|
|
|
def process_params
|
|
|
|
result = {}
|
|
|
|
data = data_source[:data]
|
2023-05-26 12:16:44 +02:00
|
|
|
|
|
|
|
Sentry.with_scope do |scope|
|
|
|
|
scope.set_tags(siret: @siret)
|
|
|
|
scope.set_extras(source: data)
|
|
|
|
if data
|
|
|
|
result[:entreprise_capital_social] = data[:capital][:montant] if data[:capital]
|
|
|
|
result[:entreprise_nom_commercial] = data[:nom_commercial]
|
|
|
|
end
|
|
|
|
result
|
2023-05-25 14:46:34 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|