Module: Jsender::Rack
Instance Method Summary collapse
- #error(code: 500, flow_id: nil, message: "An error has occurred", body_as_array: false) ⇒ Object
- #failure(code: 400, flow_id: nil, message: "A failure has occurred", data: nil, body_as_array: false) ⇒ Object
- #success(code: 200, flow_id: nil, data: nil, body_as_array: false) ⇒ Object
Instance Method Details
#error(code: 500, flow_id: nil, message: "An error has occurred", body_as_array: false) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/jsender/rack.rb', line 5 def error(code: 500, flow_id: nil, message: "An error has occurred", body_as_array: false) [ code, headers(flow_id: flow_id), body(data: Jsender::Json.error(message: ), body_as_array: body_as_array) ] end |
#failure(code: 400, flow_id: nil, message: "A failure has occurred", data: nil, body_as_array: false) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/jsender/rack.rb', line 13 def failure(code: 400, flow_id: nil, message: "A failure has occurred", data: nil, body_as_array: false) [ code, headers(flow_id: flow_id), body(data: Jsender::Json.failure(message: , data: data), body_as_array: body_as_array) ] end |
#success(code: 200, flow_id: nil, data: nil, body_as_array: false) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/jsender/rack.rb', line 21 def success(code: 200, flow_id: nil, data: nil, body_as_array: false) [ code, headers(flow_id: flow_id), body(data: Jsender::Json.success(data: data), body_as_array: body_as_array) ] end |