Class: Blather::Stanza::Iq::Ping
- Inherits:
-
Blather::Stanza::Iq
- Object
- Niceogiri::XML::Node
- XMPPNode
- Blather::Stanza
- Blather::Stanza::Iq
- Blather::Stanza::Iq::Ping
- Defined in:
- lib/blather/stanza/iq/ping.rb
Overview
# Ping Stanza
[XEP-0199: XMPP Ping](xmpp.org/extensions/xep-0199.html)
This is a base class for any Ping based Iq stanzas.
Constant Summary
Constants inherited from Blather::Stanza::Iq
Constants inherited from XMPPNode
Instance Attribute Summary
Attributes inherited from Blather::Stanza
Class Method Summary collapse
-
.new(type = :get, to = nil, id = nil) ⇒ Object
Overrides the parent method to ensure a ping node is created.
Instance Method Summary collapse
-
#inherit(node) ⇒ Object
Overrides the parent method to ensure the current ping node is destroyed.
-
#ping ⇒ Balather::XMPPNode
Ping node accessor If a ping node exists it will be returned.
Methods inherited from Blather::Stanza::Iq
#error?, #get?, import, #reply!, #result?, #set?, #type=
Methods inherited from Blather::Stanza
#as_error, #error?, #from, #from=, handler_list, #id, #id=, #initialize, next_id, register, #reply, #reply!, #to, #to=, #type, #type=
Methods inherited from XMPPNode
class_from_registration, #decorate, decorator_modules, import, parse, register, #to_stanza
Constructor Details
This class inherits a constructor from Blather::Stanza
Class Method Details
.new(type = :get, to = nil, id = nil) ⇒ Object
Overrides the parent method to ensure a ping node is created
19 20 21 22 23 |
# File 'lib/blather/stanza/iq/ping.rb', line 19 def self.new(type = :get, to = nil, id = nil) node = super node.ping node end |
Instance Method Details
#inherit(node) ⇒ Object
Overrides the parent method to ensure the current ping node is destroyed
28 29 30 31 |
# File 'lib/blather/stanza/iq/ping.rb', line 28 def inherit(node) ping.remove super end |
#ping ⇒ Balather::XMPPNode
Ping node accessor If a ping node exists it will be returned. Otherwise a new node will be created and returned
38 39 40 41 42 43 44 45 46 |
# File 'lib/blather/stanza/iq/ping.rb', line 38 def ping p = find_first 'ns:ping', :ns => self.class.registered_ns unless p (self << (p = XMPPNode.new('ping', self.document))) p.namespace = self.class.registered_ns end p end |