[fix #1701] Use DS form to enroll admin

This commit is contained in:
simon lehericey 2018-05-24 16:40:39 +02:00
parent 0b19f1a8c5
commit aaebcd3494
9 changed files with 137 additions and 1 deletions

View file

@ -1,5 +1,6 @@
class Pipedrive::PersonAdapter
PIPEDRIVE_POSTE_ATTRIBUTE_ID = '33a790746f1713d712fe97bcce9ac1ca6374a4d6'
PIPEDRIVE_SOURCE_ATTRIBUTE_ID = '2fa7864f467ffa97721cbcd08df5a3d591b15f50'
PIPEDRIVE_ROBOT_ID = '2748449'
def self.get_demandes_from_persons_owned_by_robot
@ -19,4 +20,20 @@ class Pipedrive::PersonAdapter
Pipedrive::API.put_person(person_id, params)
end
def self.add_person(email, phone, name, organization_id, poste, source)
params = {
email: email,
phone: phone,
name: name,
org_id: organization_id,
owner_id: PIPEDRIVE_ROBOT_ID,
"#{PIPEDRIVE_POSTE_ATTRIBUTE_ID}": poste,
"#{PIPEDRIVE_SOURCE_ATTRIBUTE_ID}": source
}
response = Pipedrive::API.post_person(params)
JSON.parse(response.body)['data']['id']
end
end