From 6992bea14177e93296ef8e4c124a4a94167f549d Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Thu, 31 May 2018 18:06:28 +0200 Subject: [PATCH] Add the BizDev module --- app/lib/biz_dev.rb | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 app/lib/biz_dev.rb diff --git a/app/lib/biz_dev.rb b/app/lib/biz_dev.rb new file mode 100644 index 000000000..65170e127 --- /dev/null +++ b/app/lib/biz_dev.rb @@ -0,0 +1,48 @@ +module BizDev + BIZ_DEV_MAPPING = { + 8 => + { + full_name: "Camille Garrigue", + pipedrive_id: 3189424 + }, + 9 => + { + full_name: "Philippe Vrignaud", + pipedrive_id: 2753338 + }, + 10 => + { + full_name: "Benjamin Doberset", + pipedrive_id: 4223834 + }, + 11 => + { + full_name: "RĂ©douane Bouchane", + pipedrive_id: 4438645 + } + } + + BIZ_DEV_IDS = BIZ_DEV_MAPPING.keys + + def full_name(administration_id) + id = ensure_proper_administration_id(administration_id) + + BIZ_DEV_MAPPING[id][:full_name] + end + + def pipedrive_id(administration_id) + id = ensure_proper_administration_id(administration_id) + + BIZ_DEV_MAPPING[id][:pipedrive_id] + end + + private + + def ensure_proper_administration_id(administration_id) + if administration_id.in?(BIZ_DEV_IDS) + administration_id + else + BIZ_DEV_IDS[administration_id % BIZ_DEV_IDS.length] + end + end +end