Module: Legion::Extensions::Jira::Issues::Runners::Comments

Includes:
Helpers::Lex, Helpers::Client
Included in:
Client
Defined in:
lib/legion/extensions/jira/issues/runners/comments.rb

Instance Method Summary collapse

Methods included from Helpers::Client

#connection, #upload_connection

Instance Method Details

#add_comment(issue_key:, body:) ⇒ Object



25
26
27
28
# File 'lib/legion/extensions/jira/issues/runners/comments.rb', line 25

def add_comment(issue_key:, body:, **)
  resp = connection(**).post("/rest/api/3/issue/#{issue_key}/comment", { body: body })
  { comment: resp.body }
end

#delete_comment(issue_key:, comment_id:) ⇒ Object



35
36
37
38
# File 'lib/legion/extensions/jira/issues/runners/comments.rb', line 35

def delete_comment(issue_key:, comment_id:, **)
  resp = connection(**).delete("/rest/api/3/issue/#{issue_key}/comment/#{comment_id}")
  { deleted: resp.status == 204, issue_key: issue_key, comment_id: comment_id }
end

#get_comment(issue_key:, comment_id:) ⇒ Object



20
21
22
23
# File 'lib/legion/extensions/jira/issues/runners/comments.rb', line 20

def get_comment(issue_key:, comment_id:, **)
  resp = connection(**).get("/rest/api/3/issue/#{issue_key}/comment/#{comment_id}")
  { comment: resp.body }
end

#get_issue_comments(issue_key:, start_at: 0, max_results: 50, order_by: nil) ⇒ Object



13
14
15
16
17
18
# File 'lib/legion/extensions/jira/issues/runners/comments.rb', line 13

def get_issue_comments(issue_key:, start_at: 0, max_results: 50, order_by: nil, **)
  params = { startAt: start_at, maxResults: max_results }
  params[:orderBy] = order_by if order_by
  resp = connection(**).get("/rest/api/3/issue/#{issue_key}/comment", params)
  { comments: resp.body }
end

#update_comment(issue_key:, comment_id:, body:) ⇒ Object



30
31
32
33
# File 'lib/legion/extensions/jira/issues/runners/comments.rb', line 30

def update_comment(issue_key:, comment_id:, body:, **)
  resp = connection(**).put("/rest/api/3/issue/#{issue_key}/comment/#{comment_id}", { body: body })
  { comment: resp.body }
end