Class: OpenVidu::Responder

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

Overview

Responder

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



4
5
6
# File 'lib/open_vidu/responder.rb', line 4

def object
  @object
end

#responseObject (readonly)

Returns the value of attribute response.



4
5
6
# File 'lib/open_vidu/responder.rb', line 4

def response
  @response
end

Instance Method Details

#execute(server, object, response) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/open_vidu/responder.rb', line 6

def execute(server, object, response)
  @object = object
  @response = response
  klass = Object.const_get(klass_name)

  return true if record_destroyed?
  return klass.new(server, mapped_params(response)) if complete_record?
  return klass.new(server).find(response['id']) if record_lookup?

  response[content_key].map { |hash| klass.new(server, mapped_params(hash)) }
end