Sha256: 91a9b51b572859f5beeec63ffee357d395910f7c9f8891f2626fe9da7062c821

Contents?: true

Size: 1.24 KB

Versions: 20

Compression:

Stored size: 1.24 KB

Contents

module Punchblock
  module Command
    class Redirect < CommandNode
      register :redirect, :core

      include HasHeaders

      ##
      # Create an Rayo redirect message
      #
      # @param [Hash] options
      # @option options [String] :to redirect target
      # @option options [Array[Header], Hash, Optional] :headers SIP headers to attach to
      #   the new call. Can be either a hash of key-value pairs, or an array of
      #   Header objects.
      #
      # @return [Command::Redirect] a formatted Rayo redirect command
      #
      # @example
      #    Redirect.new(:to => 'tel:+14045551234').to_xml
      #
      #    returns:
      #        <redirect to="tel:+14045551234" xmlns="urn:xmpp:rayo:1"/>
      #
      def self.new(options = {})
        super().tap do |new_node|
          new_node.to = options[:to]
          new_node.headers = options[:headers]
        end
      end

      ##
      # @return [String] the redirect target
      def to
        read_attr :to
      end

      ##
      # @param [String] redirect_to redirect target
      def to=(redirect_to)
        write_attr :to, redirect_to
      end

      def inspect_attributes # :nodoc:
        [:to] + super
      end
    end # Redirect
  end # Command
end # Punchblock

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
punchblock-0.9.2 lib/punchblock/command/redirect.rb
punchblock-0.9.1 lib/punchblock/command/redirect.rb
punchblock-0.9.0 lib/punchblock/command/redirect.rb
punchblock-0.8.4 lib/punchblock/command/redirect.rb
punchblock-0.8.3 lib/punchblock/command/redirect.rb
punchblock-0.8.2 lib/punchblock/command/redirect.rb
punchblock-0.8.1 lib/punchblock/command/redirect.rb
punchblock-0.8.0 lib/punchblock/command/redirect.rb
punchblock-0.7.2 lib/punchblock/command/redirect.rb
punchblock-0.7.1 lib/punchblock/command/redirect.rb
punchblock-0.7.0 lib/punchblock/command/redirect.rb
punchblock-0.6.2 lib/punchblock/command/redirect.rb
punchblock-0.6.1 lib/punchblock/command/redirect.rb
punchblock-0.6.0 lib/punchblock/command/redirect.rb
punchblock-0.5.1 lib/punchblock/command/redirect.rb
punchblock-0.5.0 lib/punchblock/command/redirect.rb
punchblock-0.4.3 lib/punchblock/command/redirect.rb
punchblock-0.4.2 lib/punchblock/command/redirect.rb
punchblock-0.4.1 lib/punchblock/command/redirect.rb
punchblock-0.4.0 lib/punchblock/command/redirect.rb