Class: Danger::AssignStrategies::Strategy
- Inherits:
-
Object
- Object
- Danger::AssignStrategies::Strategy
- Defined in:
- lib/gitlab_reviewbot/strategies/strategy.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#group_name ⇒ Object
Returns the value of attribute group_name.
-
#mr_iid ⇒ Object
Returns the value of attribute mr_iid.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
Instance Method Summary collapse
- #assign!(amount) ⇒ Object
- #assignees(amount) ⇒ Object
- #author ⇒ Object
-
#initialize(client:, project:, mr:, group:) ⇒ Strategy
constructor
A new instance of Strategy.
- #users_in_group ⇒ Object
Constructor Details
#initialize(client:, project:, mr:, group:) ⇒ Strategy
Returns a new instance of Strategy.
9 10 11 12 13 14 |
# File 'lib/gitlab_reviewbot/strategies/strategy.rb', line 9 def initialize(client:, project:, mr:, group:) @client = client @project_id = project @mr_iid = mr @group_name = group end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
7 8 9 |
# File 'lib/gitlab_reviewbot/strategies/strategy.rb', line 7 def client @client end |
#group_name ⇒ Object
Returns the value of attribute group_name.
6 7 8 |
# File 'lib/gitlab_reviewbot/strategies/strategy.rb', line 6 def group_name @group_name end |
#mr_iid ⇒ Object
Returns the value of attribute mr_iid.
4 5 6 |
# File 'lib/gitlab_reviewbot/strategies/strategy.rb', line 4 def mr_iid @mr_iid end |
#project_id ⇒ Object
Returns the value of attribute project_id.
5 6 7 |
# File 'lib/gitlab_reviewbot/strategies/strategy.rb', line 5 def project_id @project_id end |
Instance Method Details
#assign!(amount) ⇒ Object
16 17 18 19 20 |
# File 'lib/gitlab_reviewbot/strategies/strategy.rb', line 16 def assign!(amount) to_be_assigned = assignees(amount) response = client.assign_mr_to_users(project_id, mr_iid, to_be_assigned) return to_be_assigned.map(&:username) end |
#assignees(amount) ⇒ Object
22 23 24 |
# File 'lib/gitlab_reviewbot/strategies/strategy.rb', line 22 def assignees(amount) raise "To be implemented in the subclasses" end |
#author ⇒ Object
26 27 28 |
# File 'lib/gitlab_reviewbot/strategies/strategy.rb', line 26 def client.(@project_id, @mr_iid) end |
#users_in_group ⇒ Object
30 31 32 |
# File 'lib/gitlab_reviewbot/strategies/strategy.rb', line 30 def users_in_group client.fetch_users_for_group(group_name) end |