Class: Users::SavedReplies::UpdateService
- Inherits:
-
Object
- Object
- Users::SavedReplies::UpdateService
- Defined in:
- app/services/users/saved_replies/update_service.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(saved_reply:, name:, content:) ⇒ UpdateService
constructor
A new instance of UpdateService.
Constructor Details
#initialize(saved_reply:, name:, content:) ⇒ UpdateService
Returns a new instance of UpdateService.
6 7 8 9 10 |
# File 'app/services/users/saved_replies/update_service.rb', line 6 def initialize(saved_reply:, name:, content:) @saved_reply = saved_reply @name = name @content = content end |
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 17 18 |
# File 'app/services/users/saved_replies/update_service.rb', line 12 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.) end end |