class Punchblock::Component::Output

Public Instance Methods

inherit(xml_node) click to toggle source
Calls superclass method Punchblock::HasHeaders#inherit
# File lib/punchblock/component/output.rb, line 78
def inherit(xml_node)
  document_nodes = xml_node.xpath 'ns:document', ns: self.class.registered_ns
  self.render_documents = document_nodes.to_a.map { |node| Document.from_xml node }
  super
end
pause!() click to toggle source

Sends an Rayo pause message for the current Output

# File lib/punchblock/component/output.rb, line 171
def pause!
  raise InvalidActionError, "Cannot pause a Output that is not executing" unless executing?
  pause_action.tap do |action|
    result = write_action action
    paused! if result
  end
end
pause_action() click to toggle source

Pauses a running Output

@return [Command::Output::Pause] an Rayo pause message for the current Output

@example

output_obj.pause_action.to_xml

returns:
  <pause xmlns="urn:xmpp:rayo:output:1"/>
# File lib/punchblock/component/output.rb, line 164
def pause_action
  Pause.new :component_id => component_id, :target_call_id => target_call_id
end
rayo_attributes() click to toggle source
# File lib/punchblock/component/output.rb, line 108
def rayo_attributes
  {
    'voice' => voice,
    'interrupt-on' => interrupt_on,
    'start-offset' => start_offset,
    'start-paused' => start_paused,
    'repeat-interval' => repeat_interval,
    'repeat-times' => repeat_times,
    'max-time' => max_time,
    'renderer' => renderer
  }
end
rayo_children(root) click to toggle source
Calls superclass method Punchblock::HasHeaders#rayo_children
# File lib/punchblock/component/output.rb, line 121
def rayo_children(root)
  render_documents.each do |render_document|
    render_document.to_rayo root.parent
  end
  super
end
render_document=(other) click to toggle source

@param [Hash] other @option other [String] :content_type the document content type @option other [String] :value the output doucment @option other [String] :url the url from which to fetch the document

# File lib/punchblock/component/output.rb, line 137
def render_document=(other)
  self.render_documents = [other].compact
end
resume!() click to toggle source

Sends an Rayo resume message for the current Output

# File lib/punchblock/component/output.rb, line 196
def resume!
  raise InvalidActionError, "Cannot resume a Output that is not paused." unless paused?
  resume_action.tap do |action|
    result = write_action action
    resumed! if result
  end
end
resume_action() click to toggle source

Create an Rayo resume message for the current Output

@return [Command::Output::Resume] an Rayo resume message

@example

output_obj.resume_action.to_xml

returns:
  <resume xmlns="urn:xmpp:rayo:output:1"/>
# File lib/punchblock/component/output.rb, line 189
def resume_action
  Resume.new :component_id => component_id, :target_call_id => target_call_id
end
seek!(options = {}) click to toggle source

Sends a Rayo seek message for the current Output

# File lib/punchblock/component/output.rb, line 231
def seek!(options = {})
  raise InvalidActionError, "Cannot seek an Output that is already seeking." if seeking?
  seek_action(options).tap do |action|
    write_action action
  end
end
seek_action(options = {}) click to toggle source

Creates an Rayo seek message for the current Output

@return [Command::Output::Seek] a Rayo seek message

@example

output_obj.seek_action.to_xml

returns:
  <seek xmlns="urn:xmpp:rayo:output:1"/>
# File lib/punchblock/component/output.rb, line 222
def seek_action(options = {})
  Seek.new({ :component_id => component_id, :target_call_id => target_call_id }.merge(options)).tap do |s|
    s.original_component = self
  end
end
slow_down!() click to toggle source

Sends a Rayo slow down message for the current Output

# File lib/punchblock/component/output.rb, line 314
def slow_down!
  raise InvalidActionError, "Cannot slow down an Output that is already speeding." unless not_speeding?
  slow_down_action.tap do |action|
    write_action action
  end
end
slow_down_action() click to toggle source

Creates an Rayo slow down message for the current Output

@return [Command::Output::SlowDown] a Rayo slow down message

@example

output_obj.slow_down_action.to_xml

returns:
  <speed-down xmlns="urn:xmpp:rayo:output:1"/>
# File lib/punchblock/component/output.rb, line 305
def slow_down_action
  SlowDown.new(:component_id => component_id, :target_call_id => target_call_id).tap do |s|
    s.original_component = self
  end
end
speed_up!() click to toggle source

Sends a Rayo speed up message for the current Output

# File lib/punchblock/component/output.rb, line 288
def speed_up!
  raise InvalidActionError, "Cannot speed up an Output that is already speeding." unless not_speeding?
  speed_up_action.tap do |action|
    write_action action
  end
end
speed_up_action() click to toggle source

Creates an Rayo speed up message for the current Output

@return [Command::Output::SpeedUp] a Rayo speed up message

@example

output_obj.speed_up_action.to_xml

returns:
  <speed-up xmlns="urn:xmpp:rayo:output:1"/>
# File lib/punchblock/component/output.rb, line 279
def speed_up_action
  SpeedUp.new(:component_id => component_id, :target_call_id => target_call_id).tap do |s|
    s.original_component = self
  end
end
ssml=(other) click to toggle source
# File lib/punchblock/component/output.rb, line 141
def ssml=(other)
  self.render_documents = [{:value => other}]
end
volume_down!() click to toggle source

Sends a Rayo volume down message for the current Output

# File lib/punchblock/component/output.rb, line 408
def volume_down!
  raise InvalidActionError, "Cannot volume down an Output that is already voluming." unless not_voluming?
  volume_down_action.tap do |action|
    write_action action
  end
end
volume_down_action() click to toggle source

Creates an Rayo volume down message for the current Output

@return [Command::Output::VolumeDown] a Rayo volume down message

@example

output_obj.volume_down_action.to_xml

returns:
  <volume-down xmlns="urn:xmpp:rayo:output:1"/>
# File lib/punchblock/component/output.rb, line 399
def volume_down_action
  VolumeDown.new(:component_id => component_id, :target_call_id => target_call_id).tap do |s|
    s.original_component = self
  end
end
volume_up!() click to toggle source

Sends a Rayo volume up message for the current Output

# File lib/punchblock/component/output.rb, line 382
def volume_up!
  raise InvalidActionError, "Cannot volume up an Output that is already voluming." unless not_voluming?
  volume_up_action.tap do |action|
    write_action action
  end
end
volume_up_action() click to toggle source

Creates an Rayo volume up message for the current Output

@return [Command::Output::VolumeUp] a Rayo volume up message

@example

output_obj.volume_up_action.to_xml

returns:
  <volume-up xmlns="urn:xmpp:rayo:output:1"/>
# File lib/punchblock/component/output.rb, line 373
def volume_up_action
  VolumeUp.new(:component_id => component_id, :target_call_id => target_call_id).tap do |s|
    s.original_component = self
  end
end