Class: JiraCommand::Jira::User

Inherits:
Base
  • Object
show all
Defined in:
lib/jira_command/jira/user.rb

Constant Summary collapse

BASE_PATH =
'rest/api/2/user/assignable/search?project='.freeze

Instance Attribute Summary

Attributes inherited from Base

#config, #conn

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from JiraCommand::Jira::Base

Instance Method Details

#all_list(project:) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/jira_command/jira/user.rb', line 16

def all_list(project:)
  request_url = BASE_PATH + project
  res = @conn.get(request_url)
  body = JSON.parse(res.body)

  body.map { |item| { name: item['displayName'], account_id: item['accountId'] } }
end

#show_assignable(project:) ⇒ Object



24
25
26
# File 'lib/jira_command/jira/user.rb', line 24

def show_assignable(project:)
  puts(all_list(project: project).map { |item| item[:name] })
end