class Blather::Stanza::PubSub::Unsubscribe

# PubSub Unsubscribe Stanza

[XEP-0060 Section 6.2 - Unsubscribe from a Node](xmpp.org/extensions/xep-0060.html#subscriber-unsubscribe)

@handler :pubsub_unsubscribe

Public Class Methods

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

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

Calls superclass method 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

jid() click to toggle source

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
jid=(jid) click to toggle source

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
node() click to toggle source

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
node=(node) click to toggle source

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
subid() click to toggle source

Get the subscription ID to unsubscribe from

@return [String]

# File lib/blather/stanza/pubsub/unsubscribe.rb, line 59
def subid
  unsubscribe[:subid]
end
subid=(subid) click to toggle source

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
unsubscribe() click to toggle source

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