Class: JiraImport::UsersImporter

Inherits:
Object
  • Object
show all
Defined in:
app/services/jira_import/users_importer.rb

Instance Method Summary collapse

Constructor Details

#initialize(user, project, start_at) ⇒ UsersImporter

Returns a new instance of UsersImporter.



5
6
7
8
9
# File 'app/services/jira_import/users_importer.rb', line 5

def initialize(user, project, start_at)
  @project = project
  @start_at = start_at
  @user = user
end

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
# File 'app/services/jira_import/users_importer.rb', line 11

def execute
  Gitlab::JiraImport.validate_project_settings!(project, user: user)

  ServiceResponse.success(payload: mapped_users)
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, Errno::ECONNREFUSED, URI::InvalidURIError, JIRA::HTTPError, OpenSSL::SSL::SSLError => error
  Gitlab::ErrorTracking.log_exception(error, project_id: project.id)
  ServiceResponse.error(message: "There was an error when communicating to Jira")
rescue Projects::ImportService::Error => error
  ServiceResponse.error(message: error.message)
end