Class: QRPC::Protocol::JsonRpc::Native::QrpcObject
- Inherits:
-
JsonRpcObjects::Generic::Object
- Object
- JsonRpcObjects::Generic::Object
- QRPC::Protocol::JsonRpc::Native::QrpcObject
- Defined in:
- lib/qrpc/protocol/json-rpc/native/qrpc-object.rb
Overview
QRPC JSON-RPC QRPC object. Extends the JsonRpcObjects::Generic::Object
. See its documentation for additional methods.
Constant Summary collapse
- VERSION =
Holds JSON-RPC version indication.
JsonRpcObjects::Request::VERSION
Class Method Summary collapse
-
.create(opts = { }) ⇒ QRPC::Protocol::QrpcObject
Creates new QRPC JSON-RPC object.
Instance Method Summary collapse
-
#check! ⇒ Object
Checks correctness of the object data.
-
#output ⇒ Hash
Renders data to output form.
Class Method Details
.create(opts = { }) ⇒ QRPC::Protocol::QrpcObject
Creates new QRPC JSON-RPC object.
60 61 62 |
# File 'lib/qrpc/protocol/json-rpc/native/qrpc-object.rb', line 60 def self.create(opts = { }) self::new(opts) end |
Instance Method Details
#check! ⇒ Object
Checks correctness of the object data.
68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/qrpc/protocol/json-rpc/native/qrpc-object.rb', line 68 def check! self.normalize! if (not @priority.nil?) and not (@priority.kind_of? Numeric) raise Exception::new("Priority is expected to be Numeric.") end if not (@notification.boolean?) raise Exception::new("Notification is expected to be Boolean.") end end |
#output ⇒ Hash
Renders data to output form.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/qrpc/protocol/json-rpc/native/qrpc-object.rb', line 85 def output result = { "version" => "1.0.2" } if not @priority.nil? result["priority"] = @priority end if not @client.nil? result["client"] = @client.to_s end if @notification.true? result["notification"] = @notification end return result end |