Class: Import::Github::GistsImportService

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/import/github/gists_import_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#current_user, #params, #project

Instance Method Summary collapse

Methods included from BaseServiceUtility

#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level

Methods included from Gitlab::Allowable

#can?

Constructor Details

#initialize(user, client, params) ⇒ GistsImportService

Returns a new instance of GistsImportService.



6
7
8
9
10
# File 'app/services/import/github/gists_import_service.rb', line 6

def initialize(user, client, params)
  @current_user = user
  @params = params
  @client = client
end

Instance Method Details

#executeObject



12
13
14
15
16
17
18
19
20
# File 'app/services/import/github/gists_import_service.rb', line 12

def execute
  return error('Import already in progress', 422) if import_status.started?

  check_user_token
  start_import
  success
rescue Octokit::Unauthorized
  error('Access denied to the GitHub account.', 401)
end