Class: Punchblock::CommandNode

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

Direct Known Subclasses

Punchblock::Command::Accept, Punchblock::Command::Answer, Punchblock::Command::Dial, Punchblock::Command::Hangup, Punchblock::Command::Join, Punchblock::Command::Mute, Punchblock::Command::Redirect, Punchblock::Command::Reject, Punchblock::Command::Unjoin, Punchblock::Command::Unmute, Punchblock::Component::ComponentNode, Punchblock::Component::Output::Pause, Punchblock::Component::Output::Resume, Punchblock::Component::Output::Seek, Punchblock::Component::Output::SlowDown, Punchblock::Component::Output::SpeedUp, Punchblock::Component::Output::VolumeDown, Punchblock::Component::Output::VolumeUp, Punchblock::Component::Record::Pause, Punchblock::Component::Record::Resume, Punchblock::Component::Stop

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

- (CommandNode) initialize(*args)

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

+ (Object) new(options = {})



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

- (Object) inspect_attributes



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

def inspect_attributes
  super + [:state_name]
end

- (Object) response(timeout = nil)



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

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

- (Object) response=(other)



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

- (Object) write_attr(*args)

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