demarches-normaliennes/app/lib/api_entreprise/rna_adapter.rb

32 lines
1.1 KiB
Ruby
Raw Normal View History

2020-08-05 18:40:47 +02:00
class APIEntreprise::RNAAdapter < APIEntreprise::Adapter
# 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
private
def get_resource
api(@procedure_id).rna(@siret)
end
def process_params
data, meta = data_source.values_at(:data, :meta)
return {} if data.nil?
Sentry.with_scope do |scope|
scope.set_tags(siret: @siret)
scope.set_extras(source: data)
{
"association_rna" => data[:rna],
"association_titre" => data[:nom],
"association_objet" => data[:activites][:objet],
"association_date_creation" => data[:date_creation],
# 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],
"adresse" => data[:adresse_siege]
}
2018-02-28 17:16:03 +01:00
end
2015-12-11 10:36:16 +01:00
end
end