Class: Sinatra::JsonRpc::Request
- Inherits:
-
Object
- Object
- Sinatra::JsonRpc::Request
- Includes:
- ActiveModel::Serializers::JSON, ActiveModel::Validations
- Defined in:
- lib/sinatra/json_rpc/request.rb
Constant Summary collapse
- REQUEST_ERROR =
Sinatra::JsonRpc::RequestError
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#jsonrpc ⇒ Object
Returns the value of attribute jsonrpc.
-
#method ⇒ Object
Returns the value of attribute method.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
13 14 15 |
# File 'lib/sinatra/json_rpc/request.rb', line 13 def id @id end |
#jsonrpc ⇒ Object
Returns the value of attribute jsonrpc.
13 14 15 |
# File 'lib/sinatra/json_rpc/request.rb', line 13 def jsonrpc @jsonrpc end |
#method ⇒ Object
Returns the value of attribute method.
13 14 15 |
# File 'lib/sinatra/json_rpc/request.rb', line 13 def method @method end |
#params ⇒ Object
Returns the value of attribute params.
13 14 15 |
# File 'lib/sinatra/json_rpc/request.rb', line 13 def params @params end |
Instance Method Details
#attributes ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/sinatra/json_rpc/request.rb', line 28 def attributes { 'jsonrpc' => "2.0", 'method' => nil, 'params' => nil, 'id' => nil } end |
#attributes=(hash) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/sinatra/json_rpc/request.rb', line 21 def attributes=(hash) hash.each do |key, value| raise Sinatra::JsonRpc::RequestError unless respond_to? key instance_variable_set("@#{key}", value) end end |