Class: Suggestions::ApplyService

Inherits:
BaseService show all
Defined in:
app/services/suggestions/apply_service.rb

Instance Attribute Summary

Attributes inherited from BaseService

#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(current_user, *suggestions, message: nil) ⇒ ApplyService

Returns a new instance of ApplyService.



5
6
7
8
9
# File 'app/services/suggestions/apply_service.rb', line 5

def initialize(current_user, *suggestions, message: nil)
  @current_user = current_user
  @message = message
  @suggestion_set = Gitlab::Suggestions::SuggestionSet.new(suggestions)
end

Instance Method Details

#executeObject



11
12
13
14
15
16
17
# File 'app/services/suggestions/apply_service.rb', line 11

def execute
  if suggestion_set.valid?
    result
  else
    error(suggestion_set.error_message)
  end
end