Class: ActiveRpc::Request
- Inherits:
-
Object
- Object
- ActiveRpc::Request
- Defined in:
- lib/active_rpc/request.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(id:, method:, params:) ⇒ Request
constructor
A new instance of Request.
- #valid? ⇒ Boolean
Constructor Details
#initialize(id:, method:, params:) ⇒ Request
Returns a new instance of Request.
5 6 7 |
# File 'lib/active_rpc/request.rb', line 5 def initialize(id:, method:, params:) @id, @method, @params = id, method, params end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/active_rpc/request.rb', line 3 def id @id end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
3 4 5 |
# File 'lib/active_rpc/request.rb', line 3 def method @method end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'lib/active_rpc/request.rb', line 3 def params @params end |
Instance Method Details
#valid? ⇒ Boolean
9 10 11 12 13 14 15 16 17 |
# File 'lib/active_rpc/request.rb', line 9 def valid? [ id.present?, id.is_a?(String) || id.is_a?(Integer), method.present?, method.is_a?(String), params.nil? || params.is_a?(Array) || params.is_a?(Hash), ].all? end |