Class: IncidentManagement::TimelineEventTags::BaseService
- Inherits:
-
Object
- Object
- IncidentManagement::TimelineEventTags::BaseService
- Defined in:
- app/services/incident_management/timeline_event_tags/base_service.rb
Direct Known Subclasses
Instance Method Summary collapse
- #allowed? ⇒ Boolean
- #error(message) ⇒ Object
- #error_in_save(timeline_event_tag) ⇒ Object
- #error_no_permissions ⇒ Object
- #success(timeline_event_tag) ⇒ Object
Instance Method Details
#allowed? ⇒ Boolean
6 7 8 |
# File 'app/services/incident_management/timeline_event_tags/base_service.rb', line 6 def allowed? user&.can?(:admin_incident_management_timeline_event_tag, project) end |
#error(message) ⇒ Object
14 15 16 |
# File 'app/services/incident_management/timeline_event_tags/base_service.rb', line 14 def error() ServiceResponse.error(message: ) end |
#error_in_save(timeline_event_tag) ⇒ Object
22 23 24 |
# File 'app/services/incident_management/timeline_event_tags/base_service.rb', line 22 def error_in_save(timeline_event_tag) error(timeline_event_tag.errors..to_sentence) end |
#error_no_permissions ⇒ Object
18 19 20 |
# File 'app/services/incident_management/timeline_event_tags/base_service.rb', line 18 def error(_('You have insufficient permissions to manage timeline event tags for this project')) end |
#success(timeline_event_tag) ⇒ Object
10 11 12 |
# File 'app/services/incident_management/timeline_event_tags/base_service.rb', line 10 def success(timeline_event_tag) ServiceResponse.success(payload: { timeline_event_tag: timeline_event_tag }) end |