class Blather::Stanza::PubSubOwner::Purge

# PubSubOwner Purge Stanza

[XEP-0060 Section 8.5 - Purge All Node Items](xmpp.org/extensions/xep-0060.html#owner-purge)

@handler :pubsub_purge

Public Class Methods

new(type = :set, host = nil, node = nil) click to toggle source

Create a new purge stanza

@param [Blather::Stanza::Iq::VALID_TYPES] type the IQ stanza type @param [String] host the host to send the request to @param [String] node the name of the node to purge

Calls superclass method Blather::Stanza::PubSubOwner::new
# File lib/blather/stanza/pubsub_owner/purge.rb, line 18
def self.new(type = :set, host = nil, node = nil)
  new_node = super(type, host)
  new_node.node = node
  new_node
end

Public Instance Methods

node() click to toggle source

Get the name of the node to delete

@return [String]

# File lib/blather/stanza/pubsub_owner/purge.rb, line 27
def node
  purge_node[:node]
end
node=(node) click to toggle source

Set the name of the node to delete

@param [String] node

# File lib/blather/stanza/pubsub_owner/purge.rb, line 34
def node=(node)
  purge_node[:node] = node
end
purge_node() click to toggle source

Get or create the actual purge node on the stanza

@return [Blather::XMPPNode]

# File lib/blather/stanza/pubsub_owner/purge.rb, line 41
def purge_node
  unless purge_node = pubsub.find_first('ns:purge', :ns => self.class.registered_ns)
    self.pubsub << (purge_node = XMPPNode.new('purge', self.document))
    purge_node.namespace = self.pubsub.namespace
  end
  purge_node
end