Class: OpenVidu::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/open_vidu/command.rb

Overview

Command

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, method, endpoint, params = {}, options: {}) ⇒ Command

Returns a new instance of Command.



10
11
12
13
14
15
16
17
18
19
# File 'lib/open_vidu/command.rb', line 10

def initialize(object, method, endpoint, params = {}, options: {})
  @object = object
  @method = method
  @endpoint = endpoint
  @params = params

  @server = options.fetch(:server)
  @requestor = options[:requestor] || OpenVidu::Requestor.new(server, method, endpoint, params)
  @responder = options[:responder] || OpenVidu::Responder.new
end

Instance Attribute Details

#endpointObject (readonly)

Returns the value of attribute endpoint.



8
9
10
# File 'lib/open_vidu/command.rb', line 8

def endpoint
  @endpoint
end

#methodObject (readonly)

Returns the value of attribute method.



8
9
10
# File 'lib/open_vidu/command.rb', line 8

def method
  @method
end

#objectObject (readonly)

Returns the value of attribute object.



8
9
10
# File 'lib/open_vidu/command.rb', line 8

def object
  @object
end

#paramsObject (readonly)

Returns the value of attribute params.



8
9
10
# File 'lib/open_vidu/command.rb', line 8

def params
  @params
end

#requestorObject (readonly)

Returns the value of attribute requestor.



8
9
10
# File 'lib/open_vidu/command.rb', line 8

def requestor
  @requestor
end

#responderObject (readonly)

Returns the value of attribute responder.



8
9
10
# File 'lib/open_vidu/command.rb', line 8

def responder
  @responder
end

#serverObject (readonly)

Returns the value of attribute server.



8
9
10
# File 'lib/open_vidu/command.rb', line 8

def server
  @server
end

Instance Method Details

#executeObject



21
22
23
24
25
# File 'lib/open_vidu/command.rb', line 21

def execute
  response = requestor.execute
  raise OpenVidu::ResponseError.new(response) unless valid?(response)
  responder.execute(server, object, response.parsed_response)
end