Module: ActiveProject::Adapters::Jira::Comments
- Included in:
- ActiveProject::Adapters::JiraAdapter
- Defined in:
- lib/active_project/adapters/jira/comments.rb
Instance Method Summary collapse
-
#add_comment(issue_id_or_key, comment_body, _context = {}) ⇒ ActiveProject::Resources::Comment
Adds a comment to an issue in Jira using the V3 endpoint.
-
#delete_comment(comment_id, context = {}) ⇒ Boolean
Deletes a comment from an issue in Jira.
-
#update_comment(comment_id, body, context = {}) ⇒ ActiveProject::Resources::Comment
Updates a comment on an issue in Jira using the V3 endpoint.
Instance Method Details
#add_comment(issue_id_or_key, comment_body, _context = {}) ⇒ ActiveProject::Resources::Comment
Adds a comment to an issue in Jira using the V3 endpoint.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/active_project/adapters/jira/comments.rb', line 12 def add_comment(issue_id_or_key, comment_body, _context = {}) path = "/rest/api/3/issue/#{issue_id_or_key}/comment" payload = { body: { type: "doc", version: 1, content: [ { type: "paragraph", content: [ { type: "text", text: comment_body } ] } ] } }.to_json comment_data = make_request(:post, path, payload) map_comment_data(comment_data, issue_id_or_key) end |
#delete_comment(comment_id, context = {}) ⇒ Boolean
Deletes a comment from an issue in Jira.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/active_project/adapters/jira/comments.rb', line 55 def delete_comment(comment_id, context = {}) issue_id_or_key = context[:issue_id] unless issue_id_or_key raise ArgumentError, "Missing required context: :issue_id must be provided for JiraAdapter#delete_comment" end path = "/rest/api/3/issue/#{issue_id_or_key}/comment/#{comment_id}" make_request(:delete, path) true end |
#update_comment(comment_id, body, context = {}) ⇒ ActiveProject::Resources::Comment
Updates a comment on an issue in Jira using the V3 endpoint.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/active_project/adapters/jira/comments.rb', line 31 def update_comment(comment_id, body, context = {}) issue_id_or_key = context[:issue_id] unless issue_id_or_key raise ArgumentError, "Missing required context: :issue_id must be provided for JiraAdapter#update_comment" end path = "/rest/api/3/issue/#{issue_id_or_key}/comment/#{comment_id}" payload = { body: { type: "doc", version: 1, content: [ { type: "paragraph", content: [ { type: "text", text: body } ] } ] } }.to_json comment_data = make_request(:put, path, payload) map_comment_data(comment_data, issue_id_or_key) end |