2018-03-23 17:21:51 +01:00
|
|
|
class PipedriveService
|
2018-03-28 15:19:34 +02:00
|
|
|
def self.accept_demande_from_person(person_id, owner_id, stage_id)
|
2018-04-05 16:49:39 +02:00
|
|
|
person_deals_ids = Pipedrive::DealAdapter.fetch_waiting_deal_ids(person_id)
|
|
|
|
person_deals_ids.each { |deal_id| Pipedrive::DealAdapter.update_deal_owner_and_stage(deal_id, owner_id, stage_id) }
|
2018-03-28 11:56:19 +02:00
|
|
|
Pipedrive::PersonAdapter.update_person_owner(person_id, owner_id)
|
|
|
|
end
|
2018-03-23 17:21:51 +01:00
|
|
|
|
2018-03-28 15:19:34 +02:00
|
|
|
def self.refuse_demande_from_person(person_id, owner_id)
|
2018-04-05 16:49:39 +02:00
|
|
|
person_deals_ids = Pipedrive::DealAdapter.fetch_waiting_deal_ids(person_id)
|
|
|
|
person_deals_ids.each { |deal_id| Pipedrive::DealAdapter.refuse_deal(deal_id, owner_id) }
|
2018-03-28 11:56:19 +02:00
|
|
|
Pipedrive::PersonAdapter.update_person_owner(person_id, owner_id)
|
|
|
|
end
|
2018-03-27 13:32:14 +02:00
|
|
|
|
2018-03-28 11:56:19 +02:00
|
|
|
def self.get_demandes
|
|
|
|
Pipedrive::PersonAdapter.get_demandes_from_persons_owned_by_robot
|
2018-03-23 17:21:51 +01:00
|
|
|
end
|
|
|
|
end
|