Class: JanusGateway::Resource::Plugin
Instance Attribute Summary collapse
#client, #id
Instance Method Summary
collapse
Constructor Details
#initialize(client, session, plugin_name) ⇒ Plugin
Returns a new instance of Plugin.
12
13
14
15
16
17
|
# File 'lib/janus_gateway/resource/plugin.rb', line 12
def initialize(client, session, plugin_name)
@session = session
@name = plugin_name
super(client)
end
|
Instance Attribute Details
#name ⇒ String
7
8
9
|
# File 'lib/janus_gateway/resource/plugin.rb', line 7
def name
@name
end
|
4
5
6
|
# File 'lib/janus_gateway/resource/plugin.rb', line 4
def session
@session
end
|
Instance Method Details
#create ⇒ Concurrent::Promise
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/janus_gateway/resource/plugin.rb', line 20
def create
promise = Concurrent::Promise.new
client.send_transaction(
janus: 'attach',
plugin: name,
session_id: @session.id
).then do |*args|
_on_created(*args)
promise.set(self).execute
end.rescue do |error|
promise.fail(error).execute
end
promise
end
|
#destroy ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/janus_gateway/resource/plugin.rb', line 38
def destroy
promise = Concurrent::Promise.new
_on_destroyed
promise.set(self).execute
promise
end
|