Class: FileRpc::Message::Request
- Inherits:
-
Object
- Object
- FileRpc::Message::Request
- Defined in:
- lib/file_rpc/message/request.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#initialize(args:, timeout: FileRpc.configuration.default_timeout, id: SecureRandom.hex) ⇒ Request
constructor
A new instance of Request.
- #to_json(*_args) ⇒ Object
Constructor Details
#initialize(args:, timeout: FileRpc.configuration.default_timeout, id: SecureRandom.hex) ⇒ Request
Returns a new instance of Request.
8 9 10 11 12 13 |
# File 'lib/file_rpc/message/request.rb', line 8 def initialize(args:, timeout: FileRpc.configuration.default_timeout, id: SecureRandom.hex) @id = id @args = Array(args) @timeout = timeout @created_at = Time.now.utc end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
6 7 8 |
# File 'lib/file_rpc/message/request.rb', line 6 def args @args end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
6 7 8 |
# File 'lib/file_rpc/message/request.rb', line 6 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/file_rpc/message/request.rb', line 6 def id @id end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
6 7 8 |
# File 'lib/file_rpc/message/request.rb', line 6 def timeout @timeout end |
Instance Method Details
#to_json(*_args) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/file_rpc/message/request.rb', line 15 def to_json(*_args) { id: id, args: args, execution_timeout: timeout.to_i, created_at: created_at }.to_json end |