Class: UffizziCore::ComposeFile::ErrorsService
- Inherits:
-
Object
- Object
- UffizziCore::ComposeFile::ErrorsService
- Defined in:
- app/services/uffizzi_core/compose_file/errors_service.rb
Constant Summary collapse
- SECRETS_ERROR_KEY =
'secret_variables'
Class Method Summary collapse
- .has_error?(compose_file, error_code) ⇒ Boolean
- .has_errors?(compose_file) ⇒ Boolean
- .reset_compose_errors!(compose_file) ⇒ Object
- .reset_error!(compose_file, error_code) ⇒ Object
- .update_compose_errors!(compose_file, errors, invalid_content) ⇒ Object
Class Method Details
.has_error?(compose_file, error_code) ⇒ Boolean
6 7 8 9 10 |
# File 'app/services/uffizzi_core/compose_file/errors_service.rb', line 6 def has_error?(compose_file, error_code) error = compose_file.payload.dig('errors', error_code) error.present? end |
.has_errors?(compose_file) ⇒ Boolean
12 13 14 |
# File 'app/services/uffizzi_core/compose_file/errors_service.rb', line 12 def has_errors?(compose_file) compose_file.payload['errors'].present? end |
.reset_compose_errors!(compose_file) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'app/services/uffizzi_core/compose_file/errors_service.rb', line 26 def reset_compose_errors!(compose_file) compose_file.payload['errors'] = nil compose_file.set_valid compose_file.save! compose_file end |
.reset_error!(compose_file, error_code) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'app/services/uffizzi_core/compose_file/errors_service.rb', line 35 def reset_error!(compose_file, error_code) errors = compose_file.payload['errors'] return if errors.nil? new_errors = errors.except(error_code) compose_file.payload['errors'] = new_errors compose_file.save! compose_file end |
.update_compose_errors!(compose_file, errors, invalid_content) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/services/uffizzi_core/compose_file/errors_service.rb', line 16 def update_compose_errors!(compose_file, errors, invalid_content) compose_file.payload['errors'] = errors compose_file.set_invalid if compose_file.valid_file? compose_file.content = invalid_content compose_file.save! compose_file end |