Class: Blather::Stanza::PubSub
- Inherits:
-
Iq
- Object
- Nokogiri::XML::Node
- XMPPNode
- Blather::Stanza
- Iq
- Blather::Stanza::PubSub
- Defined in:
- lib/blather/stanza/pubsub.rb,
lib/blather/stanza/pubsub/event.rb,
lib/blather/stanza/pubsub/items.rb,
lib/blather/stanza/pubsub/create.rb,
lib/blather/stanza/pubsub/publish.rb,
lib/blather/stanza/pubsub/retract.rb,
lib/blather/stanza/pubsub/subscribe.rb,
lib/blather/stanza/pubsub/unsubscribe.rb,
lib/blather/stanza/pubsub/affiliations.rb,
lib/blather/stanza/pubsub/subscription.rb,
lib/blather/stanza/pubsub/subscriptions.rb
Direct Known Subclasses
Affiliations, Create, Items, Publish, Retract, Subscribe, Subscription, Subscriptions, Unsubscribe, PubSubErrors
Defined Under Namespace
Classes: Affiliations, Create, Event, Items, Publish, Retract, Subscribe, Subscription, Subscriptions, Unsubscribe
Constant Summary
Constants inherited from Iq
Constants inherited from XMPPNode
Class Method Summary collapse
- .import(node) ⇒ Object
-
.new(type = nil, host = nil) ⇒ Object
Ensure the namespace is set to the query node.
Instance Method Summary collapse
-
#inherit(node) ⇒ Object
Kill the pubsub node before running inherit.
- #pubsub ⇒ Object
Methods inherited from Iq
Methods inherited from Blather::Stanza
#as_error, attribute_helpers_for, #from, handler_list, next_id, register, #reply, #reply!, #to
Methods inherited from XMPPNode
attribute_accessor, attribute_reader, attribute_writer, class_from_registration, content_attr_accessor, content_attr_reader, content_attr_writer, #content_from, #inherit_attrs, #namespace=, #namespace_href, #nokogiri_namespace=, register, #remove_child, #remove_children, #set_content_for, #to_stanza
Methods inherited from Nokogiri::XML::Node
#[]=, #attr_set, #find_first, #nokogiri_xpath, #xpath
Class Method Details
.import(node) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/blather/stanza/pubsub.rb', line 7 def self.import(node) klass = nil if pubsub = node.document.find_first('//ns:pubsub', :ns => self.registered_ns) pubsub.children.each { |e| break if klass = class_from_registration(e.element_name, (e.namespace.href if e.namespace)) } end (klass || self).new(node[:type]).inherit(node) end |
.new(type = nil, host = nil) ⇒ Object
Ensure the namespace is set to the query node
17 18 19 20 21 22 |
# File 'lib/blather/stanza/pubsub.rb', line 17 def self.new(type = nil, host = nil) new_node = super type new_node.to = host new_node.pubsub new_node end |
Instance Method Details
#inherit(node) ⇒ Object
Kill the pubsub node before running inherit
26 27 28 29 |
# File 'lib/blather/stanza/pubsub.rb', line 26 def inherit(node) remove_children :pubsub super end |
#pubsub ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/blather/stanza/pubsub.rb', line 31 def pubsub p = find_first('ns:pubsub', :ns => self.class.registered_ns) || find_first('pubsub', :ns => self.class.registered_ns) unless p self << (p = XMPPNode.new('pubsub', self.document)) p.namespace = self.class.registered_ns end p end |