Class: QRPC::Protocol::JsonRpc::Request
- Inherits:
-
Abstract::Request
- Object
- Abstract::Object
- Abstract::Request
- QRPC::Protocol::JsonRpc::Request
- Defined in:
- lib/qrpc/protocol/json-rpc/request.rb
Overview
JSON-RPC request implementation.
Instance Attribute Summary collapse
-
#native ⇒ JsonRpcObjects::Response
Returns the native object.
Attributes inherited from Abstract::Object
Class Method Summary collapse
-
.parse(raw) ⇒ Request
Parses the data for new object.
Instance Method Summary collapse
-
#client ⇒ Object
Returns the QRPC request client identifier.
-
#id ⇒ Object
Returns ID of the request.
-
#method ⇒ Symbol
Returns method identifier of the request.
-
#notification? ⇒ Boolean
Indicates, job is notification.
-
#params ⇒ Array
Returns method params of the request.
-
#priority ⇒ Integer
Returns the QRPC request priority.
-
#serialize ⇒ String
Serializes object to the resultant form.
Methods inherited from Abstract::Request
Methods inherited from Abstract::Object
Constructor Details
This class inherits a constructor from QRPC::Protocol::Abstract::Request
Instance Attribute Details
#native ⇒ JsonRpcObjects::Response
Returns the native object.
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/qrpc/protocol/json-rpc/request.rb', line 62 def native if @native.nil? client_id = @options.client_id.to_s qrpc = QRPC::Protocol::JsonRpc::Native::QrpcObject::create(:client => client_id, :priority => @options.priority, :notification => @options.notification) qrpc.serializer = @options.serializer @native = JsonRpcObjects::Request::create(@options[:method], @options.arguments, :id => @options.id, :qrpc => qrpc.output) @native.serializer = @options.serializer end @native end |
Class Method Details
.parse(raw) ⇒ Request
Parses the data for new object.
50 51 52 53 54 |
# File 'lib/qrpc/protocol/json-rpc/request.rb', line 50 def self.parse(raw) object = self::new object.native = JsonRpcObjects::Request::parse(raw, :wd, self::.serializer) return object end |
Instance Method Details
#client ⇒ Object
Returns the QRPC request client identifier.
125 126 127 |
# File 'lib/qrpc/protocol/json-rpc/request.rb', line 125 def client @native.qrpc["client"] end |
#id ⇒ Object
Returns ID of the request.
89 90 91 |
# File 'lib/qrpc/protocol/json-rpc/request.rb', line 89 def id self.native.id end |
#method ⇒ Symbol
Returns method identifier of the request.
98 99 100 |
# File 'lib/qrpc/protocol/json-rpc/request.rb', line 98 def method @native.method end |
#notification? ⇒ Boolean
Indicates, job is notification.
134 135 136 |
# File 'lib/qrpc/protocol/json-rpc/request.rb', line 134 def notification? @native.qrpc["notification"] end |
#params ⇒ Array
Returns method params of the request.
107 108 109 |
# File 'lib/qrpc/protocol/json-rpc/request.rb', line 107 def params @native.params end |
#priority ⇒ Integer
Returns the QRPC request priority.
116 117 118 |
# File 'lib/qrpc/protocol/json-rpc/request.rb', line 116 def priority @native.qrpc["priority"] end |
#serialize ⇒ String
Serializes object to the resultant form.
80 81 82 |
# File 'lib/qrpc/protocol/json-rpc/request.rb', line 80 def serialize self.native.serialize end |