Class: OpenVidu::Base

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

Overview

Base

Direct Known Subclasses

Config, Recording, Session, Token

Constant Summary collapse

ASSIGNABLE_PARAMS =
%w[].freeze
GENERATED_PARAMS =
%w[].freeze
ALL_PARAMS =
(ASSIGNABLE_PARAMS + GENERATED_PARAMS).freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, params = {}) ⇒ Base

Returns a new instance of Base.



17
18
19
20
21
22
23
# File 'lib/open_vidu/base.rb', line 17

def initialize(uri, params = {})
  @server = Server.new(uri).freeze
  self.class::ALL_PARAMS.each do |param|
    instance_variable_set("@#{param}", params[param.to_sym])
    self.class.send(:attr_accessor, param.to_sym)
  end
end

Instance Attribute Details

#serverObject (readonly)

Returns the value of attribute server.



11
12
13
# File 'lib/open_vidu/base.rb', line 11

def server
  @server
end

Class Method Details

.content_keyObject



13
14
15
# File 'lib/open_vidu/base.rb', line 13

def self.content_key
  'content'
end

Instance Method Details

#create_paramsObject



25
26
27
28
29
30
31
# File 'lib/open_vidu/base.rb', line 25

def create_params
  Hash[
    self.class::ASSIGNABLE_PARAMS.map do |param|
      [param, instance_variable_get("@#{param}")]
    end
  ]
end