Class: Blather::Stanza::PubSub::Unsubscribe
- Inherits:
-
Blather::Stanza::PubSub
- Object
- Niceogiri::XML::Node
- XMPPNode
- Blather::Stanza
- Iq
- Blather::Stanza::PubSub
- Blather::Stanza::PubSub::Unsubscribe
- Defined in:
- lib/blather/stanza/pubsub/unsubscribe.rb
Overview
# PubSub Unsubscribe Stanza
[XEP-0060 Section 6.2 - Unsubscribe from a Node](xmpp.org/extensions/xep-0060.html#subscriber-unsubscribe)
Constant Summary
Constants inherited from Iq
Constants inherited from XMPPNode
Instance Attribute Summary
Attributes inherited from Blather::Stanza
Class Method Summary collapse
-
.new(type = :set, host = nil, node = nil, jid = nil, subid = nil) ⇒ Object
Create a new unsubscribe node.
Instance Method Summary collapse
-
#jid ⇒ Blather::JID
Get the JID of the unsubscription.
-
#jid=(jid) ⇒ Object
Set the JID of the unsubscription.
-
#node ⇒ String
Get the name of the node to unsubscribe from.
-
#node=(node) ⇒ Object
Set the name of the node to unsubscribe from.
-
#subid ⇒ String
Get the subscription ID to unsubscribe from.
-
#subid=(subid) ⇒ Object
Set the subscription ID to unsubscribe from.
-
#unsubscribe ⇒ Blather::XMPPNode
Get or create the actual unsubscribe node.
Methods inherited from Blather::Stanza::PubSub
Methods inherited from 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 = :set, host = nil, node = nil, jid = nil, subid = nil) ⇒ Object
Create a new unsubscribe node
20 21 22 23 24 25 26 |
# 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 |
Instance Method Details
#jid ⇒ Blather::JID
Get the JID of the unsubscription
31 32 33 |
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 31 def jid JID.new(unsubscribe[:jid]) end |
#jid=(jid) ⇒ Object
Set the JID of the unsubscription
38 39 40 |
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 38 def jid=(jid) unsubscribe[:jid] = jid end |
#node ⇒ String
Get the name of the node to unsubscribe from
45 46 47 |
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 45 def node unsubscribe[:node] end |
#node=(node) ⇒ Object
Set the name of the node to unsubscribe from
52 53 54 |
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 52 def node=(node) unsubscribe[:node] = node end |
#subid ⇒ String
Get the subscription ID to unsubscribe from
59 60 61 |
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 59 def subid unsubscribe[:subid] end |
#subid=(subid) ⇒ Object
Set the subscription ID to unsubscribe from
66 67 68 |
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 66 def subid=(subid) unsubscribe[:subid] = subid end |
#unsubscribe ⇒ Blather::XMPPNode
Get or create the actual unsubscribe node
73 74 75 76 77 78 79 |
# 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 |