demarches-normaliennes/app/services/pipedrive_service.rb

18 lines
787 B
Ruby
Raw Normal View History

2018-03-23 17:21:51 +01:00
class PipedriveService
def self.accept_demande_from_person(person_id, owner_id, stage_id)
2018-04-05 16:50:57 +02:00
person_deals_ids = Pipedrive::DealAdapter.get_deals_ids_for_person(person_id)
2018-04-05 16:49:39 +02:00
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
def self.refuse_demande_from_person(person_id, owner_id)
2018-04-05 16:50:57 +02:00
person_deals_ids = Pipedrive::DealAdapter.get_deals_ids_for_person(person_id)
2018-04-05 16:49:39 +02:00
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