Class: AntiAbuse::AbuseReport::CreateService
- Inherits:
-
BaseService
- Object
- BaseService
- AntiAbuse::AbuseReport::CreateService
- Defined in:
- app/services/anti_abuse/abuse_report/create_service.rb
Constant Summary
Constants inherited from BaseService
BaseService::UnauthorizedError
Instance Attribute Summary collapse
-
#abuse_report ⇒ Object
readonly
Returns the value of attribute abuse_report.
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(params) ⇒ CreateService
constructor
A new instance of CreateService.
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
Constructor Details
#initialize(params) ⇒ CreateService
Returns a new instance of CreateService.
8 9 10 |
# File 'app/services/anti_abuse/abuse_report/create_service.rb', line 8 def initialize(params) @params = params.dup end |
Instance Attribute Details
#abuse_report ⇒ Object (readonly)
Returns the value of attribute abuse_report.
6 7 8 |
# File 'app/services/anti_abuse/abuse_report/create_service.rb', line 6 def abuse_report @abuse_report end |
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 17 18 |
# File 'app/services/anti_abuse/abuse_report/create_service.rb', line 12 def execute return error('Reporter param must be a valid User') unless valid_reporter? return error('AbuseReport record was not created') unless create_abuse_report ServiceResponse.success(payload: abuse_report) end |