34
35
36
37
38
39
40
41
42
|
# File 'app/services/assistant/publication_tool_builder.rb', line 34
def execute(id:, offset: 0, **)
publication = Item.publications.active.with_publication_attached.find_by(id: id.to_i)
return { error: 'Publication not found.' }.to_json unless publication
payload_for(publication, offset: offset.to_i).to_json
rescue StandardError => e
Rails.logger.error("[PublicationToolBuilder] Read failed: #{e.class}: #{e.message}")
{ error: 'Publication could not be read.' }.to_json
end
|