Class: Gitlab::Triage::Action::Summarize
- Inherits:
-
Base
- Object
- Base
- Gitlab::Triage::Action::Summarize
show all
- Defined in:
- lib/gitlab/triage/action/summarize.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
Instance Method Details
#act ⇒ Object
32
33
34
|
# File 'lib/gitlab/triage/action/summarize.rb', line 32
def act
perform if issue.valid?
end
|
#destination ⇒ Object
51
52
53
|
# File 'lib/gitlab/triage/action/summarize.rb', line 51
def destination
issue.destination || network.options.source_id
end
|
#group_summary_without_destination? ⇒ Boolean
55
56
57
|
# File 'lib/gitlab/triage/action/summarize.rb', line 55
def group_summary_without_destination?
network.options.source == :groups && !issue.destination
end
|
#issue ⇒ Object
47
48
49
|
# File 'lib/gitlab/triage/action/summarize.rb', line 47
def issue
@issue ||= policy.build_summary
end
|
38
39
40
41
42
43
44
45
|
# File 'lib/gitlab/triage/action/summarize.rb', line 38
def perform
if group_summary_without_destination?
puts Gitlab::Triage::UI.warn("Issue was not created: No summary destination specified when source is 'groups'.")
return
end
policy.summary = network.post_api(post_issue_url, post_issue_body)
end
|
#post_issue_body ⇒ Object
73
74
75
76
77
78
|
# File 'lib/gitlab/triage/action/summarize.rb', line 73
def post_issue_body
{
title: issue.title,
description: issue.description
}
end
|
#post_issue_url ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/gitlab/triage/action/summarize.rb', line 59
def post_issue_url
post_url = UrlBuilders::UrlBuilder.new(
network_options: network.options,
source_id: destination,
resource_type: 'issues'
).build
puts Gitlab::Triage::UI.debug "post_issue_url: #{post_url}" if network.options.debug
post_url
end
|