Class: Blather::Stanza::PubSub::Unsubscribe
- Inherits:
-
Blather::Stanza::PubSub
- Object
- Nokogiri::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
Class Method Summary collapse
-
.new(type = :set, host = nil, node = nil, jid = 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.
-
#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=, next_id, register, #reply, #reply!, #to, #to=, #type, #type=
Methods inherited from XMPPNode
class_from_registration, #content_from, import, #inherit, #inherit_attrs, #inspect, #namespace=, #namespace_href, #nokogiri_namespace=, #read_attr, #read_content, register, #remove_child, #remove_children, #set_content_for, #to_stanza, #write_attr
Methods inherited from Nokogiri::XML::Node
#[]=, #attr_set, #find_first, #nokogiri_xpath, #xpath
Class Method Details
.new(type = :set, host = nil, node = nil, jid = nil) ⇒ Object
Create a new unsubscribe node
19 20 21 22 23 24 |
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 19 def self.new(type = :set, host = nil, node = nil, jid = nil) new_node = super(type, host) new_node.node = node new_node.jid = jid new_node end |
Instance Method Details
#jid ⇒ Blather::JID
Get the JID of the unsubscription
29 30 31 |
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 29 def jid JID.new(unsubscribe[:jid]) end |
#jid=(jid) ⇒ Object
Set the JID of the unsubscription
36 37 38 |
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 36 def jid=(jid) unsubscribe[:jid] = jid end |
#node ⇒ String
Get the name of the node to unsubscribe from
43 44 45 |
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 43 def node unsubscribe[:node] end |
#node=(node) ⇒ Object
Set the name of the node to unsubscribe from
50 51 52 |
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 50 def node=(node) unsubscribe[:node] = node end |
#unsubscribe ⇒ Blather::XMPPNode
Get or create the actual unsubscribe node
57 58 59 60 61 62 63 |
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 57 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 |