Class: Gitlab::Triage::Action::Delete

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/triage/action/delete.rb

Direct Known Subclasses

Dry

Defined Under Namespace

Classes: Dry

Instance Attribute Summary

Attributes inherited from Base

#network, #policy

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Gitlab::Triage::Action::Base

Instance Method Details

#actObject



22
23
24
25
26
27
28
# File 'lib/gitlab/triage/action/delete.rb', line 22

def act
  return unless policy.type&.to_sym == :branches

  policy.resources.each do |resource|
    perform(resource)
  end
end

#build_delete_url(resource) ⇒ Object (private)



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/gitlab/triage/action/delete.rb', line 36

def build_delete_url(resource)
  delete_url = UrlBuilders::UrlBuilder.new(
    source: policy.source,
    source_id: network.options.source_id,
    resource_type: policy.type,
    resource_id: resource_id(resource),
    network_options: network.options
  ).build

  puts Gitlab::Triage::UI.debug "delete_url: #{delete_url}" if network.options.debug

  delete_url
end

#perform(resource) ⇒ Object (private)



32
33
34
# File 'lib/gitlab/triage/action/delete.rb', line 32

def perform(resource)
  network.delete_api(build_delete_url(resource))
end

#resource_id(resource) ⇒ Object (private)



50
51
52
# File 'lib/gitlab/triage/action/delete.rb', line 50

def resource_id(resource)
  resource[:name]
end