Sha256: 1fec533cadcae680db623ebb6f4fc27078d484923b44d06658e5218e8365e16d

Contents?: true

Size: 774 Bytes

Versions: 8

Compression:

Stored size: 774 Bytes

Contents

# encoding: utf-8

module Blather
  class Stanza
    RAYO_NODE_PATH = "(#{Punchblock::RAYO_NAMESPACES.keys.map { |k| "#{k}:*" }.join("|")})".freeze
    ##
    # @return [Punchblock::RayoNode] a child of RayoNode
    #   representing the Rayo command/event contained within the stanza
    #
    def rayo_node
      @rayo_node ||= begin
        first_child = at_xpath RAYO_NODE_PATH, Punchblock::RAYO_NAMESPACES
        Punchblock::RayoNode.from_xml first_child, nil, component_id, "xmpp:#{from}" if first_child
      end
    end

    ##
    # @return [String] the call ID this stanza applies to
    #
    def call_id
      from.node
    end

    ##
    # @return [String] the command ID this stanza applies to
    #
    def component_id
      from.resource
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
punchblock-2.3.1 lib/punchblock/core_ext/blather/stanza.rb
punchblock-2.3.0 lib/punchblock/core_ext/blather/stanza.rb
punchblock-2.2.2 lib/punchblock/core_ext/blather/stanza.rb
punchblock-2.2.1 lib/punchblock/core_ext/blather/stanza.rb
punchblock-2.2.0 lib/punchblock/core_ext/blather/stanza.rb
punchblock-2.1.1 lib/punchblock/core_ext/blather/stanza.rb
punchblock-2.1.0 lib/punchblock/core_ext/blather/stanza.rb
punchblock-2.0.2 lib/punchblock/core_ext/blather/stanza.rb