Mutualize some code in Pipedrive::API#get
This commit is contained in:
parent
d287eb0e5f
commit
d202e0173e
3 changed files with 5 additions and 9 deletions
|
@ -40,7 +40,8 @@ class Pipedrive::API
|
|||
private
|
||||
|
||||
def self.get(url, params)
|
||||
RestClient.get(url, params: params)
|
||||
response = RestClient.get(url, params: params)
|
||||
JSON.parse(response.body)['data']
|
||||
end
|
||||
|
||||
def self.put(url, params)
|
||||
|
|
|
@ -24,10 +24,8 @@ class Pipedrive::DealAdapter
|
|||
end
|
||||
|
||||
def self.fetch_waiting_deal_ids(person_id)
|
||||
response = Pipedrive::API.get_deals_for_person(person_id)
|
||||
json_data = JSON.parse(response.body)['data']
|
||||
|
||||
json_data.map { |datum| datum['id'] }
|
||||
Pipedrive::API.get_deals_for_person(person_id)
|
||||
.map { |datum| datum['id'] }
|
||||
end
|
||||
|
||||
def self.update_deal_owner_and_stage(deal_id, owner_id, stage_id)
|
||||
|
|
|
@ -3,10 +3,7 @@ class Pipedrive::PersonAdapter
|
|||
PIPEDRIVE_ROBOT_ID = '2748449'
|
||||
|
||||
def self.get_demandes_from_persons_owned_by_robot
|
||||
response = Pipedrive::API.get_persons_owned_by_user(PIPEDRIVE_ROBOT_ID)
|
||||
json_data = JSON.parse(response.body)['data']
|
||||
|
||||
json_data.map do |datum|
|
||||
Pipedrive::API.get_persons_owned_by_user(PIPEDRIVE_ROBOT_ID).map do |datum|
|
||||
{
|
||||
person_id: datum['id'],
|
||||
nom: datum['name'],
|
||||
|
|
Loading…
Reference in a new issue