Class: Pages::Publish
- Inherits:
-
BaseService
- Object
- BaseService
- Pages::Publish
- Defined in:
- app/services/postnhost/publishing/pages/publish.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(page:) ⇒ Publish
constructor
A new instance of Publish.
Constructor Details
#initialize(page:) ⇒ Publish
Returns a new instance of Publish.
4 5 6 |
# File 'app/services/postnhost/publishing/pages/publish.rb', line 4 def initialize(page:) @page = page end |
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/services/postnhost/publishing/pages/publish.rb', line 8 def call snapshot = Revision.hold do page.lock! Pages::SnapshotWriter.new(page:).call end success(snapshot, status: :ok) rescue Error => e failure(e.) rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique => e failure(e.) end |