Class: Rack::RPC::Endpoint::JSONRPC::Request

Inherits:
Notification show all
Defined in:
lib/rack/rpc/endpoint/jsonrpc.rb

Overview

JSON-RPC request objects.

Constant Summary

Constants inherited from Object

Object::OPTIONS

Instance Attribute Summary collapse

Attributes inherited from Notification

#method, #params, #version

Attributes inherited from Object

#context

Instance Method Summary collapse

Methods inherited from Object

#initialize, parse, #to_json

Constructor Details

This class inherits a constructor from Rack::RPC::Endpoint::JSONRPC::Object

Instance Attribute Details

#idObject

Returns the value of attribute id.



169
170
171
# File 'lib/rack/rpc/endpoint/jsonrpc.rb', line 169

def id
  @id
end

Instance Method Details

#to_argsArray

Returns:

  • (Array)


187
188
189
190
# File 'lib/rack/rpc/endpoint/jsonrpc.rb', line 187

def to_args
  # used from Operation#initialize
  params
end

#to_hashHash

Returns:

  • (Hash)


179
180
181
182
183
# File 'lib/rack/rpc/endpoint/jsonrpc.rb', line 179

def to_hash
  super.merge({
    :id => id,
  })
end

#valid?Boolean

Returns:

  • (Boolean)


173
174
175
# File 'lib/rack/rpc/endpoint/jsonrpc.rb', line 173

def valid?
  super && !id.nil?
end