Class: Blather::Stanza

Inherits:
Object show all
Defined in:
lib/adhearsion/core_ext/blather/stanza.rb,
lib/adhearsion/core_ext/blather/stanza/presence.rb

Defined Under Namespace

Classes: Presence

Constant Summary collapse

RAYO_NODE_PATH =
"(#{Adhearsion::Rayo::RAYO_NAMESPACES.keys.map { |k| "#{k}:*" }.join("|")})".freeze

Instance Method Summary collapse

Instance Method Details

#call_idString

Returns the call ID this stanza applies to

Returns:

  • (String)

    the call ID this stanza applies to



22
23
24
# File 'lib/adhearsion/core_ext/blather/stanza.rb', line 22

def call_id
  from.node
end

#component_idString

Returns the command ID this stanza applies to

Returns:

  • (String)

    the command ID this stanza applies to



29
30
31
# File 'lib/adhearsion/core_ext/blather/stanza.rb', line 29

def component_id
  from.resource
end

#rayo_nodeAdhearsion::Rayo::RayoNode

Returns a child of RayoNode representing the Rayo command/event contained within the stanza

Returns:



12
13
14
15
16
17
# File 'lib/adhearsion/core_ext/blather/stanza.rb', line 12

def rayo_node
  @rayo_node ||= begin
    first_child = at_xpath RAYO_NODE_PATH, Adhearsion::Rayo::RAYO_NAMESPACES
    Adhearsion::Rayo::RayoNode.from_xml first_child, nil, component_id, "xmpp:#{from}", delay_timestamp if first_child
  end
end