Class: Blather::Stanza::PubSub::Create
- Inherits:
-
Blather::Stanza::PubSub
- Object
- Nokogiri::XML::Node
- XMPPNode
- Blather::Stanza
- Iq
- Blather::Stanza::PubSub
- Blather::Stanza::PubSub::Create
- Defined in:
- lib/blather/stanza/pubsub/create.rb
Overview
# PubSub Create Stanza
[XEP-0060 Section 8.1 - Create a Node](xmpp.org/extensions/xep-0060.html#owner-create)
Constant Summary
Constants inherited from Iq
Constants inherited from XMPPNode
Class Method Summary collapse
-
.new(type = :set, host = nil, node = nil) ⇒ Object
Create a new Create Stanza.
Instance Method Summary collapse
-
#configure_node ⇒ Blather::XMPPNode
Get or create the actual configure node on the stanza.
-
#create_node ⇒ Balther::XMPPNode
Get or create the actual create node on the stanza.
-
#node ⇒ String?
Get the name of the node to create.
-
#node=(node) ⇒ Object
Set the name of the node to create.
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) ⇒ Object
Create a new Create Stanza
18 19 20 21 22 23 24 |
# File 'lib/blather/stanza/pubsub/create.rb', line 18 def self.new(type = :set, host = nil, node = nil) new_node = super(type, host) new_node.create_node new_node.configure_node new_node.node = node new_node end |
Instance Method Details
#configure_node ⇒ Blather::XMPPNode
Get or create the actual configure node on the stanza
54 55 56 57 58 59 60 |
# File 'lib/blather/stanza/pubsub/create.rb', line 54 def configure_node unless configure_node = pubsub.find_first('ns:configure', :ns => self.class.registered_ns) self.pubsub << (configure_node = XMPPNode.new('configure', self.document)) configure_node.namespace = self.pubsub.namespace end configure_node end |
#create_node ⇒ Balther::XMPPNode
Get or create the actual create node on the stanza
43 44 45 46 47 48 49 |
# File 'lib/blather/stanza/pubsub/create.rb', line 43 def create_node unless create_node = pubsub.find_first('ns:create', :ns => self.class.registered_ns) self.pubsub << (create_node = XMPPNode.new('create', self.document)) create_node.namespace = self.pubsub.namespace end create_node end |
#node ⇒ String?
Get the name of the node to create
29 30 31 |
# File 'lib/blather/stanza/pubsub/create.rb', line 29 def node create_node[:node] end |
#node=(node) ⇒ Object
Set the name of the node to create
36 37 38 |
# File 'lib/blather/stanza/pubsub/create.rb', line 36 def node=(node) create_node[:node] = node end |