From 1f226d882cad383d23623f91a93fd7506205612e Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 28 Mar 2018 11:56:19 +0200 Subject: [PATCH] Dont use the `class << self` pattern --- app/services/pipedrive_service.rb | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/app/services/pipedrive_service.rb b/app/services/pipedrive_service.rb index 8e4261ae7..b38425f2e 100644 --- a/app/services/pipedrive_service.rb +++ b/app/services/pipedrive_service.rb @@ -1,19 +1,17 @@ class PipedriveService - class << self - def accept_deals_from_person(person_id, owner_id, stage_id) - waiting_deal_ids = Pipedrive::DealAdapter.fetch_waiting_deal_ids(person_id) - waiting_deal_ids.each { |deal_id| Pipedrive::DealAdapter.update_deal_owner_and_stage(deal_id, owner_id, stage_id) } - Pipedrive::PersonAdapter.update_person_owner(person_id, owner_id) - end + def self.accept_deals_from_person(person_id, owner_id, stage_id) + waiting_deal_ids = Pipedrive::DealAdapter.fetch_waiting_deal_ids(person_id) + waiting_deal_ids.each { |deal_id| Pipedrive::DealAdapter.update_deal_owner_and_stage(deal_id, owner_id, stage_id) } + Pipedrive::PersonAdapter.update_person_owner(person_id, owner_id) + end - def refuse_deals_from_person(person_id, owner_id) - waiting_deal_ids = Pipedrive::DealAdapter.fetch_waiting_deal_ids(person_id) - waiting_deal_ids.each { |deal_id| Pipedrive::DealAdapter.refuse_deal(deal_id, owner_id) } - Pipedrive::PersonAdapter.update_person_owner(person_id, owner_id) - end + def self.refuse_deals_from_person(person_id, owner_id) + waiting_deal_ids = Pipedrive::DealAdapter.fetch_waiting_deal_ids(person_id) + waiting_deal_ids.each { |deal_id| Pipedrive::DealAdapter.refuse_deal(deal_id, owner_id) } + Pipedrive::PersonAdapter.update_person_owner(person_id, owner_id) + end - def get_demandes - Pipedrive::PersonAdapter.get_demandes_from_persons_owned_by_robot - end + def self.get_demandes + Pipedrive::PersonAdapter.get_demandes_from_persons_owned_by_robot end end