Module: JPC::Helpers
- Included in:
- Dispatcher, Invoker
- Defined in:
- lib/jpc/helpers.rb
Instance Method Summary collapse
- #make_error(id, code, message) ⇒ Object
- #make_message(data) ⇒ Object
- #make_response(id, data) ⇒ Object
- #make_result(id, result) ⇒ Object
Instance Method Details
#make_error(id, code, message) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/jpc/helpers.rb', line 17 def make_error(id, code, ) error = { code: code, message: } make_response(id, error: error) end |
#make_message(data) ⇒ Object
3 4 5 6 |
# File 'lib/jpc/helpers.rb', line 3 def (data) = { jsonrpc: JPC::RPC_VERSION }.merge!(data) Oj.dump(, mode: :compat) end |
#make_response(id, data) ⇒ Object
8 9 10 11 |
# File 'lib/jpc/helpers.rb', line 8 def make_response(id, data) response = { id: id }.merge!(data) (response) end |
#make_result(id, result) ⇒ Object
13 14 15 |
# File 'lib/jpc/helpers.rb', line 13 def make_result(id, result) make_response(id, result: result) end |