Module: Legion::Extensions::Jira::Issues::Runners::Watchers

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

Instance Method Summary collapse

Methods included from Helpers::Client

#connection, #upload_connection

Instance Method Details

#add_watcher(issue_key:, account_id:) ⇒ Object



18
19
20
21
# File 'lib/legion/extensions/jira/issues/runners/watchers.rb', line 18

def add_watcher(issue_key:, account_id:, **)
  resp = connection(**).post("/rest/api/3/issue/#{issue_key}/watchers", .to_json)
  { added: resp.status == 204, issue_key: issue_key }
end

#get_watchers(issue_key:) ⇒ Object



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

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

#remove_watcher(issue_key:, account_id:) ⇒ Object



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

def remove_watcher(issue_key:, account_id:, **)
  resp = connection(**).delete("/rest/api/3/issue/#{issue_key}/watchers") do |req|
    req.params['accountId'] = 
  end
  { removed: resp.status == 204, issue_key: issue_key }
end