Class: JiraImport::UsersMapperService

Inherits:
Object
  • Object
show all
Includes:
Gitlab::Utils::StrongMemoize
Defined in:
app/services/jira_import/users_mapper_service.rb

Constant Summary collapse

MAX_USERS =

MAX_USERS must match the pageSize value in app/assets/javascripts/jira_import/utils/constants.js

50

Instance Method Summary collapse

Constructor Details

#initialize(current_user, project, start_at) ⇒ UsersMapperService

The class is called from UsersImporter and small batches of users are expected In case the mapping of a big batch of users is expected to be passed here the implementation needs to change here and handles the matching in batches



13
14
15
16
17
18
# File 'app/services/jira_import/users_mapper_service.rb', line 13

def initialize(current_user, project, start_at)
  @current_user = current_user
  @project = project
  @jira_integration = project.jira_integration
  @start_at = start_at
end

Instance Method Details

#executeObject



20
21
22
23
24
25
26
27
28
# File 'app/services/jira_import/users_mapper_service.rb', line 20

def execute
  jira_users.to_a.map do |jira_user|
    {
      jira_account_id: jira_user_id(jira_user),
      jira_display_name: jira_user_name(jira_user),
      jira_email: jira_user['emailAddress']
    }.merge(gitlab_id: find_gitlab_id(jira_user))
  end
end