Module: RestResponseModel
- Included in:
- RestApplication, RestBase
- Defined in:
- lib/rest/rest_response_model.rb
Instance Method Summary collapse
Instance Method Details
#error_response(error_code = 'FAILED', errors = []) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/rest/rest_response_model.rb', line 10 def error_response(error_code='FAILED', errors=[]) response = { status: error_code } response[:errors] = errors if !errors.nil? && errors.any? response end |
#success_response(data = nil) ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/rest/rest_response_model.rb', line 2 def success_response(data=nil) response = { status: 'OK' } response[:data] = data if data response end |