Class: Blather::Stanza::PubSub::Subscribe
- Inherits:
-
Blather::Stanza::PubSub
- Object
- Niceogiri::XML::Node
- XMPPNode
- Blather::Stanza
- Iq
- Blather::Stanza::PubSub
- Blather::Stanza::PubSub::Subscribe
- Defined in:
- lib/blather/stanza/pubsub/subscribe.rb
Overview
# PubSub Subscribe Stanza
[XEP-0060 Section 6.1 - Subscribe to a Node](xmpp.org/extensions/xep-0060.html#subscriber-subscribe)
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) ⇒ Object
Create a new subscription node.
Instance Method Summary collapse
-
#jid ⇒ Blather::JID
Get the JID of the entity to subscribe.
-
#jid=(jid) ⇒ Object
Set the JID of the entity to subscribe.
-
#node ⇒ String
Get the name of the node to subscribe to.
-
#node=(node) ⇒ Object
Set the name of the node to subscribe to.
-
#subscribe ⇒ Blather::XMPPNode
Get or create the actual subscribe node on the stanza.
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) ⇒ Object
Create a new subscription node
19 20 21 22 23 24 |
# File 'lib/blather/stanza/pubsub/subscribe.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 entity to subscribe
29 30 31 |
# File 'lib/blather/stanza/pubsub/subscribe.rb', line 29 def jid JID.new(subscribe[:jid]) end |
#jid=(jid) ⇒ Object
Set the JID of the entity to subscribe
36 37 38 |
# File 'lib/blather/stanza/pubsub/subscribe.rb', line 36 def jid=(jid) subscribe[:jid] = jid end |
#node ⇒ String
Get the name of the node to subscribe to
43 44 45 |
# File 'lib/blather/stanza/pubsub/subscribe.rb', line 43 def node subscribe[:node] end |
#node=(node) ⇒ Object
Set the name of the node to subscribe to
50 51 52 |
# File 'lib/blather/stanza/pubsub/subscribe.rb', line 50 def node=(node) subscribe[:node] = node end |
#subscribe ⇒ Blather::XMPPNode
Get or create the actual subscribe node on the stanza
57 58 59 60 61 62 63 |
# File 'lib/blather/stanza/pubsub/subscribe.rb', line 57 def subscribe unless subscribe = pubsub.find_first('ns:subscribe', :ns => self.class.registered_ns) self.pubsub << (subscribe = XMPPNode.new('subscribe', self.document)) subscribe.namespace = self.pubsub.namespace end subscribe end |