From ace8441ec7b77b3a01c10d8fec1a4c87bc601449 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Tue, 10 Apr 2018 12:24:49 +0200 Subject: [PATCH] SIRETService -> ApiEntrepriseService --- app/controllers/champs/siret_controller.rb | 2 +- app/controllers/users/dossiers_controller.rb | 2 +- app/jobs/etablissement_update_job.rb | 2 +- app/services/{siret_service.rb => api_entreprise_service.rb} | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename app/services/{siret_service.rb => api_entreprise_service.rb} (97%) diff --git a/app/controllers/champs/siret_controller.rb b/app/controllers/champs/siret_controller.rb index b1fb41b55..d735d2de4 100644 --- a/app/controllers/champs/siret_controller.rb +++ b/app/controllers/champs/siret_controller.rb @@ -14,7 +14,7 @@ class Champs::SiretController < ApplicationController end @error = "SIRET invalide" else - etablissement_attributes = SIRETService.fetch(siret, @champ.dossier.procedure_id) + etablissement_attributes = ApiEntrepriseService.fetch(siret, @champ.dossier.procedure_id) if etablissement_attributes.present? @etablissement = @champ.build_etablissement(etablissement_attributes) @etablissement.champ = @champ diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index 12fd0573a..c9484b5c7 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -107,7 +107,7 @@ class Users::DossiersController < UsersController update_current_user_siret!(siret) - etablissement_attributes = SIRETService.fetch(siret, @facade.dossier.procedure_id, @facade.dossier) + etablissement_attributes = ApiEntrepriseService.fetch(siret, @facade.dossier.procedure_id, @facade.dossier) if etablissement_attributes.present? etablissement_attributes = ActionController::Parameters.new(etablissement_attributes).permit! diff --git a/app/jobs/etablissement_update_job.rb b/app/jobs/etablissement_update_job.rb index 10566f8cf..4ccf5c440 100644 --- a/app/jobs/etablissement_update_job.rb +++ b/app/jobs/etablissement_update_job.rb @@ -2,7 +2,7 @@ class EtablissementUpdateJob < ApplicationJob queue_as :default def perform(dossier, siret) - etablissement_attributes = SIRETService.fetch(siret, dossier.procedure_id, dossier) + etablissement_attributes = ApiEntrepriseService.fetch(siret, dossier.procedure_id, dossier) if etablissement_attributes.present? if dossier.entreprise.present? diff --git a/app/services/siret_service.rb b/app/services/api_entreprise_service.rb similarity index 97% rename from app/services/siret_service.rb rename to app/services/api_entreprise_service.rb index a037fe2b5..cbdd47446 100644 --- a/app/services/siret_service.rb +++ b/app/services/api_entreprise_service.rb @@ -1,4 +1,4 @@ -class SIRETService +class ApiEntrepriseService def self.fetch(siret, procedure_id, dossier = nil) etablissement_params = ApiEntreprise::EtablissementAdapter.new(siret, procedure_id).to_params entreprise_params = ApiEntreprise::EntrepriseAdapter.new(siret, procedure_id).to_params