Exception: JsonRpc::Rpc::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- JsonRpc::Rpc::Error
- Defined in:
- lib/json-rpc.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#id ⇒ Object
Returns the value of attribute id.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(status, code, msg) ⇒ Error
constructor
A new instance of Error.
- #result ⇒ Object
Constructor Details
#initialize(status, code, msg) ⇒ Error
42 43 44 |
# File 'lib/json-rpc.rb', line 42 def initialize status, code, msg @status, @code, @msg = status, code, msg end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
40 41 42 |
# File 'lib/json-rpc.rb', line 40 def code @code end |
#id ⇒ Object
Returns the value of attribute id.
41 42 43 |
# File 'lib/json-rpc.rb', line 41 def id @id end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
40 41 42 |
# File 'lib/json-rpc.rb', line 40 def msg @msg end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
40 41 42 |
# File 'lib/json-rpc.rb', line 40 def status @status end |
Instance Method Details
#result ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/json-rpc.rb', line 45 def result res = {"jsonrpc" => "2.0", "id" => id, "error" => {"code" => code, "message" => msg} } res.delete_if { |k, v| v == nil} res.to_json end |