From 298d7d050cf4b88ea872461a251817ff987e7fd4 Mon Sep 17 00:00:00 2001 From: gregoirenovel Date: Wed, 28 Mar 2018 14:41:14 +0200 Subject: [PATCH] Mutualize some code in Pipedrive::API#put --- app/lib/pipedrive/api.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/lib/pipedrive/api.rb b/app/lib/pipedrive/api.rb index 0ff9ced04..1b08b361d 100644 --- a/app/lib/pipedrive/api.rb +++ b/app/lib/pipedrive/api.rb @@ -16,13 +16,13 @@ class Pipedrive::API end 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) end 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) end @@ -41,6 +41,8 @@ class Pipedrive::API end def self.put(url, params) + url = "#{url}?api_token=#{PIPEDRIVE_TOKEN}" + RestClient.put(url, params.to_json, { content_type: :json }) end end