Mutualize some code in Pipedrive::API#put
This commit is contained in:
parent
e688fc4212
commit
298d7d050c
1 changed files with 4 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue