diff options
Diffstat (limited to 'app/services/concerns/services/return_service_responses.rb')
-rw-r--r-- | app/services/concerns/services/return_service_responses.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/services/concerns/services/return_service_responses.rb b/app/services/concerns/services/return_service_responses.rb new file mode 100644 index 00000000000..75432b76033 --- /dev/null +++ b/app/services/concerns/services/return_service_responses.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +module Services + # adapter for existing services over BaseServiceUtility - add error and + # success methods returning ServiceResponse objects + module ReturnServiceResponses + def error(message, http_status, pass_back: {}) + ServiceResponse.error(message: message, http_status: http_status, payload: pass_back) + end + + def success(payload) + ServiceResponse.success(payload: payload) + end + end +end |