Class: Rack::RPC::Endpoint::JSONRPC::Notification

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

Overview

JSON-RPC notification objects.

Direct Known Subclasses

Request

Constant Summary

Constants inherited from Object

Object::OPTIONS

Instance Attribute Summary collapse

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

#methodObject

Returns the value of attribute method.



146
147
148
# File 'lib/rack/rpc/endpoint/jsonrpc.rb', line 146

def method
  @method
end

#paramsObject

Returns the value of attribute params.



147
148
149
# File 'lib/rack/rpc/endpoint/jsonrpc.rb', line 147

def params
  @params
end

#versionObject

Returns the value of attribute version.



145
146
147
# File 'lib/rack/rpc/endpoint/jsonrpc.rb', line 145

def version
  @version
end

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


157
158
159
160
161
162
163
# File 'lib/rack/rpc/endpoint/jsonrpc.rb', line 157

def to_hash
  {
    :jsonrpc => (version || VERSION).to_s,
    :method  => method.to_s,
    :params  => params ? params.to_a : [], # NOTE: named arguments not supported
  }
end

#valid?Boolean

Returns:

  • (Boolean)


151
152
153
# File 'lib/rack/rpc/endpoint/jsonrpc.rb', line 151

def valid?
  true # TODO
end