Class: Punchblock::Command::Redirect

Inherits:
Punchblock::CommandNode show all
Includes:
HasHeaders
Defined in:
lib/punchblock/command/redirect.rb

Instance Attribute Summary

Attributes inherited from RayoNode

#call_id, #client, #component_id, #connection, #original_component

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HasHeaders

#headers, #headers=, #headers_hash

Methods inherited from Punchblock::CommandNode

#initialize, #response, #response=, #write_attr

Methods inherited from RayoNode

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

Constructor Details

This class inherits a constructor from Punchblock::CommandNode

Class Method Details

.new(options = {}) ⇒ Command::Redirect

Create an Rayo redirect message

Examples:

Redirect.new(:to => 'tel:+14045551234').to_xml

returns:
    <redirect to="tel:+14045551234" xmlns="urn:xmpp:rayo:1"/>

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :to (String)

    redirect target

  • :headers (Array[Header], Hash, Optional)

    SIP headers to attach to the new call. Can be either a hash of key-value pairs, or an array of Header objects.

Returns:



25
26
27
28
29
30
# File 'lib/punchblock/command/redirect.rb', line 25

def self.new(options = {})
  super().tap do |new_node|
    new_node.to = options[:to]
    new_node.headers = options[:headers]
  end
end

Instance Method Details

#inspect_attributesObject

:nodoc:



44
45
46
# File 'lib/punchblock/command/redirect.rb', line 44

def inspect_attributes # :nodoc:
  [:to] + super
end

#toString

Returns the redirect target.

Returns:

  • (String)

    the redirect target



34
35
36
# File 'lib/punchblock/command/redirect.rb', line 34

def to
  read_attr :to
end

#to=(redirect_to) ⇒ Object

Parameters:

  • redirect_to (String)

    redirect target



40
41
42
# File 'lib/punchblock/command/redirect.rb', line 40

def to=(redirect_to)
  write_attr :to, redirect_to
end