Class: Publication::Reviser
- Inherits:
-
BaseService
- Object
- BaseService
- Publication::Reviser
- Defined in:
- app/services/publication/reviser.rb
Overview
Service object: reviser.
Defined Under Namespace
Classes: Result
Instance Attribute Summary
Attributes inherited from BaseService
Instance Method Summary collapse
Methods inherited from BaseService
#initialize, #log_debug, #log_error, #log_info, #log_warning, #logger, #tagged_logger
Constructor Details
This class inherits a constructor from BaseService
Instance Method Details
#process(original_publication) ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/services/publication/reviser.rb', line 10 def process(original_publication) new_publication = original_publication.deep_dup new_publication.sku = original_publication.new_revision_sku if new_publication.save original_publication.discontinue_self_and_dependents Result.new(success: true, new_publication: new_publication) else Result.new(success: false, errors: new_publication.errors.) end end |