-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhttp_put.rb
More file actions
23 lines (22 loc) · 873 Bytes
/
http_put.rb
File metadata and controls
23 lines (22 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
data = {objective: {name: @objective_name, note: @objective_note,
owner_type: "Squad", owner_id: @objective_owner.id, parent_id: @parent_id}
}
if @objective_id == 0
HTTP.post("/api/v3/objective.json", payload: data) do |response|
if response.ok?
show_objective_modal! false
UIHelpers::UIHelper.set_alert @objective_name, "has been created"
else
alert "Unable to create Objective"
end
end
else
HTTP.patch("/api/v3/objective/#{@objective_id}.json", payload: data) do |response|
if response.ok?
show_objective_modal! false
UIHelpers::UIHelper.set_alert @objective_name, "has been updated"
else
alert "Unable to update Objective"
end
end
end