Sha256: 88a1d03c081f8143674679a96b1233a445e6ced36372c86ca017b3818a22a151

Contents?: true

Size: 758 Bytes

Versions: 3

Compression:

Stored size: 758 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 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

3 entries across 3 versions & 1 rubygems

Version Path
punchblock-2.0.1 lib/punchblock/core_ext/blather/stanza.rb
punchblock-2.0.0 lib/punchblock/core_ext/blather/stanza.rb
punchblock-2.0.0.beta2 lib/punchblock/core_ext/blather/stanza.rb