Mutualize some code in Pipedrive::API#put

This commit is contained in:
gregoirenovel 2018-03-28 14:41:14 +02:00
parent e688fc4212
commit 298d7d050c

View file

@ -16,13 +16,13 @@ class Pipedrive::API
end end
def self.put_deal(deal_id, params) def self.put_deal(deal_id, params)
url = PIPEDRIVE_DEALS_URL + "/#{deal_id}?api_token=#{PIPEDRIVE_TOKEN}" url = PIPEDRIVE_DEALS_URL + "/#{deal_id}"
self.put(url, params) self.put(url, params)
end end
def self.put_person(person_id, params) def self.put_person(person_id, params)
url = PIPEDRIVE_PEOPLE_URL + "/#{person_id}?api_token=#{PIPEDRIVE_TOKEN}" url = PIPEDRIVE_PEOPLE_URL + "/#{person_id}"
self.put(url, params) self.put(url, params)
end end
@ -41,6 +41,8 @@ class Pipedrive::API
end end
def self.put(url, params) def self.put(url, params)
url = "#{url}?api_token=#{PIPEDRIVE_TOKEN}"
RestClient.put(url, params.to_json, { content_type: :json }) RestClient.put(url, params.to_json, { content_type: :json })
end end
end end