-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
clickup.rb
26 lines (25 loc) · 1.02 KB
/
clickup.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Class to interface with the ClickUp API
class ClickUp
# Creates a new task in ClickUp in the configured list
def self.create_task(body)
JSON.parse RestClient.post("#{BASE_URLS[:clickup]}/list/#{CLICKUP_LIST_ID}/task",
body.to_json,
Authorization: TOKENS[:clickup],
content_type: :json,
accept: :json)
rescue RestClient::BadRequest => e
print "Could not create task! #{e.response.body}"
end
# Updates a task on ClickUp
# @param id [String] The task ID
# @param update [Hash] The update data
def self.update_task(id, update)
JSON.parse RestClient.put("#{BASE_URLS[:clickup]}/task/#{id}",
update.to_json,
Authorization: TOKENS[:clickup],
content_type: :json,
accept: :json)
rescue RestClient::BadRequest => e
print "Could not update task! #{e.response.body}"
end
end