Class: DSP::Request

Inherits:
DSPBase show all
Defined in:
lib/dsp/dsp_protocol.rb

Overview

interface Request extends ProtocolMessage {

    /** The command to execute. */
    command: string;
    /** Object containing arguments for the command. */
    arguments?: any;
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DSPBase

#to_h, #to_json

Constructor Details

#initialize(initial_hash = nil) ⇒ Request

Returns a new instance of Request.



40
41
42
43
# File 'lib/dsp/dsp_protocol.rb', line 40

def initialize(initial_hash = nil)
  super
  @optional_method_names = %i[arguments]
end

Instance Attribute Details

#argumentsObject

type: string # type: any # type: number # type: string



38
39
40
# File 'lib/dsp/dsp_protocol.rb', line 38

def arguments
  @arguments
end

#commandObject

type: string # type: any # type: number # type: string



38
39
40
# File 'lib/dsp/dsp_protocol.rb', line 38

def command
  @command
end

#seqObject

type: string # type: any # type: number # type: string



38
39
40
# File 'lib/dsp/dsp_protocol.rb', line 38

def seq
  @seq
end

#typeObject

type: string # type: any # type: number # type: string



38
39
40
# File 'lib/dsp/dsp_protocol.rb', line 38

def type
  @type
end

Instance Method Details

#from_h!(value) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/dsp/dsp_protocol.rb', line 45

def from_h!(value)
  value = {} if value.nil?
  self.command = value['command']
  self.arguments = value['arguments']
  self.seq = value['seq']
  self.type = value['type']
  self
end