class Blather::Stanza::PubSub::Subscribe
[XEP-0060 Section 6.1 - Subscribe
to a Node](xmpp.org/extensions/xep-0060.html#subscriber-subscribe)
@handler :pubsub_subscribe
Public Class Methods
new(type = :set, host = nil, node = nil, jid = nil)
click to toggle source
Create
a new subscription node
@param [Blather::Stanza::Iq::VALID_TYPES] type the IQ stanza type @param [String] host the host name to send the request to @param [String] node the node to subscribe to @param [Blather::JID, to_s] jid see {#jid=}
Calls superclass method
Blather::Stanza::PubSub::new
# 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
Public Instance Methods
jid()
click to toggle source
Get the JID
of the entity to subscribe
@return [Blather::JID]
# File lib/blather/stanza/pubsub/subscribe.rb, line 29 def jid JID.new(subscribe[:jid]) end
jid=(jid)
click to toggle source
Set the JID
of the entity to subscribe
@param [Blather::JID, to_s] jid
# File lib/blather/stanza/pubsub/subscribe.rb, line 36 def jid=(jid) subscribe[:jid] = jid end
node()
click to toggle source
Get the name of the node to subscribe to
@return [String]
# File lib/blather/stanza/pubsub/subscribe.rb, line 43 def node subscribe[:node] end
node=(node)
click to toggle source
Set the name of the node to subscribe to
@param [String] node
# File lib/blather/stanza/pubsub/subscribe.rb, line 50 def node=(node) subscribe[:node] = node end
subscribe()
click to toggle source
Get or create the actual subscribe node on the stanza
@return [Blather::XMPPNode]
# 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