Class: Punchblock::CommandNode

Inherits:
RayoNode show all
Defined in:
lib/punchblock/command_node.rb

Constant Summary

Constants inherited from RayoNode

RayoNode::InvalidNodeError

Instance Attribute Summary

Attributes inherited from RayoNode

#client, #component_id, #connection, #domain, #original_component, #target_call_id, #target_mixer_name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RayoNode

class_from_registration, #eql?, import, #inspect, register, #source

Constructor Details

#initialize(*args) ⇒ CommandNode

Returns a new instance of CommandNode.



15
16
17
18
# File 'lib/punchblock/command_node.rb', line 15

def initialize(*args)
  super
  @response = FutureResource.new
end

Class Method Details

.new(options = {}) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/punchblock/command_node.rb', line 7

def self.new(options = {})
  super().tap do |new_node|
    new_node.target_call_id = options[:target_call_id]
    new_node.target_mixer_name = options[:target_mixer_name]
    new_node.component_id = options[:component_id]
  end
end

Instance Method Details

#inspect_attributesObject



49
50
51
# File 'lib/punchblock/command_node.rb', line 49

def inspect_attributes
  super + [:state_name]
end

#response(timeout = nil) ⇒ Object



39
40
41
# File 'lib/punchblock/command_node.rb', line 39

def response(timeout = nil)
  @response.resource timeout
end

#response=(other) ⇒ Object



43
44
45
46
47
# File 'lib/punchblock/command_node.rb', line 43

def response=(other)
  return if @response.set_yet?
  @response.resource = other
  execute!
end

#write_attr(*args) ⇒ Object

Raises:

  • (StandardError)


34
35
36
37
# File 'lib/punchblock/command_node.rb', line 34

def write_attr(*args)
  raise StandardError, "Cannot alter attributes of a requested command" unless new?
  super
end