Class: Blather::Stanza::PubSub::Create

Inherits:
Blather::Stanza::PubSub show all
Defined in:
lib/blather/stanza/pubsub/create.rb

Constant Summary

Constants inherited from Iq

Iq::VALID_TYPES

Constants inherited from XMPPNode

XMPPNode::BASE_NAMES

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Blather::Stanza::PubSub

import, #inherit, #pubsub

Methods inherited from Iq

import, #type=

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, import, #inherit, #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

.new(type = :set, host = nil, node = nil) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/blather/stanza/pubsub/create.rb', line 8

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_nodeObject



32
33
34
35
36
37
38
# File 'lib/blather/stanza/pubsub/create.rb', line 32

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_nodeObject



24
25
26
27
28
29
30
# File 'lib/blather/stanza/pubsub/create.rb', line 24

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

#nodeObject



16
17
18
# File 'lib/blather/stanza/pubsub/create.rb', line 16

def node
  create_node[:node]
end

#node=(node) ⇒ Object



20
21
22
# File 'lib/blather/stanza/pubsub/create.rb', line 20

def node=(node)
  create_node[:node] = node
end