= 200 def respond_with(result, serializer:, status: DEFAULT_STATUS) if result.success? respond_with_success( result.value!, serializer: serializer, status: status ) else respond_with_failure(result.failure) end end def respond_with_success(result, serializer:, status: DEFAULT_STATUS) self.body = serializer.new(result).to_json self.status = status end def respond_with_failure(failure) # ... end end end end