class Blather::Stanza::PubSub::Unsubscribe
[XEP-0060 Section 6.2 - Unsubscribe
from a Node](xmpp.org/extensions/xep-0060.html#subscriber-unsubscribe)
@handler :pubsub_unsubscribe
Public Class Methods
Create
a new unsubscribe node
@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 node to unsubscribe from @param [Blather::JID, to_s] jid the JID
of the unsubscription @param [String] subid the subscription ID of the unsubscription
Blather::Stanza::PubSub::new
# File lib/blather/stanza/pubsub/unsubscribe.rb, line 20 def self.new(type = :set, host = nil, node = nil, jid = nil, subid = nil) new_node = super(type, host) new_node.node = node new_node.jid = jid new_node.subid = subid new_node end
Public Instance Methods
Get the JID
of the unsubscription
@return [Blather::JID]
# File lib/blather/stanza/pubsub/unsubscribe.rb, line 31 def jid JID.new(unsubscribe[:jid]) end
Set the JID
of the unsubscription
@param [Blather::JID, to_s] jid
# File lib/blather/stanza/pubsub/unsubscribe.rb, line 38 def jid=(jid) unsubscribe[:jid] = jid end
Get the name of the node to unsubscribe from
@return [String]
# File lib/blather/stanza/pubsub/unsubscribe.rb, line 45 def node unsubscribe[:node] end
Set the name of the node to unsubscribe from
@param [String] node
# File lib/blather/stanza/pubsub/unsubscribe.rb, line 52 def node=(node) unsubscribe[:node] = node end
Get the subscription ID to unsubscribe from
@return [String]
# File lib/blather/stanza/pubsub/unsubscribe.rb, line 59 def subid unsubscribe[:subid] end
Set the subscription ID to unsubscribe from
@param [String] node
# File lib/blather/stanza/pubsub/unsubscribe.rb, line 66 def subid=(subid) unsubscribe[:subid] = subid end
Get or create the actual unsubscribe node
@return [Blather::XMPPNode]
# File lib/blather/stanza/pubsub/unsubscribe.rb, line 73 def unsubscribe unless unsubscribe = pubsub.find_first('ns:unsubscribe', :ns => self.class.registered_ns) self.pubsub << (unsubscribe = XMPPNode.new('unsubscribe', self.document)) unsubscribe.namespace = self.pubsub.namespace end unsubscribe end