2022-03-14 20:07:30 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Users
|
|
|
|
module SavedReplies
|
|
|
|
class UpdateService
|
2022-03-18 11:07:23 -04:00
|
|
|
def initialize(saved_reply:, name:, content:)
|
2022-03-14 20:07:30 -04:00
|
|
|
@saved_reply = saved_reply
|
|
|
|
@name = name
|
|
|
|
@content = content
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
|
|
if saved_reply.update(name: name, content: content)
|
|
|
|
ServiceResponse.success(payload: { saved_reply: saved_reply.reset })
|
|
|
|
else
|
|
|
|
ServiceResponse.error(message: saved_reply.errors.full_messages)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2022-03-18 11:07:23 -04:00
|
|
|
attr_reader :saved_reply, :name, :content
|
2022-03-14 20:07:30 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|