Class: Blather::Stanza::PubSubOwner::Delete

Inherits:
Blather::Stanza::PubSubOwner show all
Defined in:
lib/blather/stanza/pubsub_owner/delete.rb

Overview

# PubSubOwner Delete Stanza

[XEP-0060 Section 8.4 Delete a Node](xmpp.org/extensions/xep-0060.html#owner-delete)

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::PubSubOwner

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

Parameters:

  • type (Blather::Stanza::Iq::VALID_TYPES) (defaults to: :set)

    the IQ stanza type

  • host (String) (defaults to: nil)

    the host to send the request to

  • node (String) (defaults to: nil)

    the name of the node to delete



18
19
20
21
22
# File 'lib/blather/stanza/pubsub_owner/delete.rb', line 18

def self.new(type = :set, host = nil, node = nil)
  new_node = super(type, host)
  new_node.node = node
  new_node
end

Instance Method Details

#delete_nodeBlather::XMPPNode

Get or create the actual delete node on the stanza

Returns:



41
42
43
44
45
46
47
# File 'lib/blather/stanza/pubsub_owner/delete.rb', line 41

def delete_node
  unless delete_node = pubsub.find_first('ns:delete', :ns => self.class.registered_ns)
    self.pubsub << (delete_node = XMPPNode.new('delete', self.document))
    delete_node.namespace = self.pubsub.namespace
  end
  delete_node
end

#nodeString

Get the name of the node to delete

Returns:

  • (String)


27
28
29
# File 'lib/blather/stanza/pubsub_owner/delete.rb', line 27

def node
  delete_node[:node]
end

#node=(node) ⇒ Object

Set the name of the node to delete

Parameters:

  • node (String)


34
35
36
# File 'lib/blather/stanza/pubsub_owner/delete.rb', line 34

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