Class: Users::SavedReplies::DestroyService

Inherits:
Object
  • Object
show all
Defined in:
app/services/users/saved_replies/destroy_service.rb

Instance Method Summary collapse

Constructor Details

#initialize(saved_reply:) ⇒ DestroyService

Returns a new instance of DestroyService.



6
7
8
# File 'app/services/users/saved_replies/destroy_service.rb', line 6

def initialize(saved_reply:)
  @saved_reply = saved_reply
end

Instance Method Details

#executeObject



10
11
12
13
14
15
16
# File 'app/services/users/saved_replies/destroy_service.rb', line 10

def execute
  if saved_reply.destroy
    ServiceResponse.success(payload: { saved_reply: saved_reply })
  else
    ServiceResponse.error(message: saved_reply.errors.full_messages)
  end
end