Improve a method name

This commit is contained in:
gregoirenovel 2018-04-05 16:50:57 +02:00
parent 136f15b89c
commit 26b66aac96
2 changed files with 3 additions and 3 deletions

View file

@ -23,7 +23,7 @@ class Pipedrive::DealAdapter
Pipedrive::API.put_deal(deal_id, params)
end
def self.fetch_waiting_deal_ids(person_id)
def self.get_deals_ids_for_person(person_id)
Pipedrive::API.get_deals_for_person(person_id)
.map { |datum| datum['id'] }
end

View file

@ -1,12 +1,12 @@
class PipedriveService
def self.accept_demande_from_person(person_id, owner_id, stage_id)
person_deals_ids = Pipedrive::DealAdapter.fetch_waiting_deal_ids(person_id)
person_deals_ids = Pipedrive::DealAdapter.get_deals_ids_for_person(person_id)
person_deals_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.refuse_demande_from_person(person_id, owner_id)
person_deals_ids = Pipedrive::DealAdapter.fetch_waiting_deal_ids(person_id)
person_deals_ids = Pipedrive::DealAdapter.get_deals_ids_for_person(person_id)
person_deals_ids.each { |deal_id| Pipedrive::DealAdapter.refuse_deal(deal_id, owner_id) }
Pipedrive::PersonAdapter.update_person_owner(person_id, owner_id)
end