Class: Protein::Payload::Request
- Inherits:
-
Object
- Object
- Protein::Payload::Request
- Defined in:
- lib/protein/payload.rb
Class Method Summary collapse
Class Method Details
.decode(payload) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/protein/payload.rb', line 16 def decode(payload) hash = JSON.parse(payload) service_name = hash["service_name"] request_buf_b64 = hash["request_buf_b64"] request_buf = Base64.strict_decode64(request_buf_b64) [service_name, request_buf] end |
.encode(service_name, request_buf) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/protein/payload.rb', line 9 def encode(service_name, request_buf) JSON.dump({ "service_name" => service_name, "request_buf_b64" => Base64.strict_encode64(request_buf) }) end |