Class: PipeRpc::Request
- Defined in:
- lib/pipe_rpc/request.rb,
lib/pipe_rpc/hub_request.rb,
lib/pipe_rpc/client_request.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
-
#initialize(args) ⇒ Request
constructor
A new instance of Request.
- #to_h ⇒ Object
Constructor Details
#initialize(args) ⇒ Request
Returns a new instance of Request.
3 4 5 6 7 8 |
# File 'lib/pipe_rpc/request.rb', line 3 def initialize(args) @server = args.fetch(:server, :default).to_sym @method = args.fetch(:method).to_sym @arguments = args.fetch(:arguments, []) @id = args.fetch(:id, nil) end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
10 11 12 |
# File 'lib/pipe_rpc/request.rb', line 10 def arguments @arguments end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/pipe_rpc/request.rb', line 10 def id @id end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
10 11 12 |
# File 'lib/pipe_rpc/request.rb', line 10 def method @method end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
10 11 12 |
# File 'lib/pipe_rpc/request.rb', line 10 def server @server end |
Instance Method Details
#to_h ⇒ Object
12 13 14 |
# File 'lib/pipe_rpc/request.rb', line 12 def to_h { server: server, method: method, arguments: arguments, id: id } end |