2024-04-29 00:17:15 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-08-05 18:40:47 +02:00
|
|
|
class APIEntreprise::RNAAdapter < APIEntreprise::Adapter
|
2023-05-30 11:32:59 +02:00
|
|
|
# Doc métier : https://entreprise.api.gouv.fr/catalogue/djepva/associations_open_data
|
|
|
|
# Swagger : https://entreprise.api.gouv.fr/developpeurs/openapi#tag/Informations-generales/paths/~1v4~1djepva~1api-association~1associations~1open_data~1%7Bsiren_or_rna%7D/get
|
2022-09-22 17:13:53 +02:00
|
|
|
|
2018-03-19 15:45:55 +01:00
|
|
|
private
|
|
|
|
|
|
|
|
def get_resource
|
2022-07-20 14:52:17 +02:00
|
|
|
api(@procedure_id).rna(@siret)
|
2018-03-19 15:45:55 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def process_params
|
2023-05-31 09:43:11 +02:00
|
|
|
data, meta = data_source.values_at(:data, :meta)
|
2023-05-30 11:32:59 +02:00
|
|
|
return {} if data.nil?
|
2023-01-11 12:12:24 +01:00
|
|
|
|
|
|
|
Sentry.with_scope do |scope|
|
|
|
|
scope.set_tags(siret: @siret)
|
2023-05-30 11:32:59 +02:00
|
|
|
scope.set_extras(source: data)
|
|
|
|
|
|
|
|
{
|
|
|
|
"association_rna" => data[:rna],
|
|
|
|
"association_titre" => data[:nom],
|
|
|
|
"association_objet" => data[:activites][:objet],
|
|
|
|
"association_date_creation" => data[:date_creation],
|
2023-05-31 09:43:11 +02:00
|
|
|
# see: https://mattermost.incubateur.net/betagouv/pl/r6txumw9cpyx58rt7iq5dte9qe
|
|
|
|
"association_date_declaration" => meta[:date_derniere_mise_a_jour_rna],
|
2024-01-31 17:28:00 +01:00
|
|
|
"association_date_publication" => data[:date_publication_journal_officiel],
|
2024-02-05 18:47:40 +01:00
|
|
|
"adresse" => data[:adresse_siege]
|
2023-05-30 11:32:59 +02:00
|
|
|
}
|
2018-02-28 17:16:03 +01:00
|
|
|
end
|
2015-12-11 10:36:16 +01:00
|
|
|
end
|
|
|
|
end
|