Class: Gitlab::BitbucketImport::KeyDeleter

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/bitbucket_import/key_deleter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ KeyDeleter

Returns a new instance of KeyDeleter


6
7
8
9
10
# File 'lib/gitlab/bitbucket_import/key_deleter.rb', line 6

def initialize(project)
  @project = project
  @current_user = project.creator
  @client = Client.from_project(@project)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client


4
5
6
# File 'lib/gitlab/bitbucket_import/key_deleter.rb', line 4

def client
  @client
end

#current_userObject (readonly)

Returns the value of attribute current_user


4
5
6
# File 'lib/gitlab/bitbucket_import/key_deleter.rb', line 4

def current_user
  @current_user
end

#projectObject (readonly)

Returns the value of attribute project


4
5
6
# File 'lib/gitlab/bitbucket_import/key_deleter.rb', line 4

def project
  @project
end

Instance Method Details

#executeObject


12
13
14
15
16
17
18
19
20
# File 'lib/gitlab/bitbucket_import/key_deleter.rb', line 12

def execute
  return false unless BitbucketImport.public_key.present?

  client.delete_deploy_key(project.import_source, BitbucketImport.public_key)

  true
rescue
  false
end