Sha256: 4584c4f34b487c07cf0e08c82ba873e48cec79cad4b3ecb54badf81b09fe6a38

Contents?: true

Size: 1.32 KB

Versions: 48

Compression:

Stored size: 1.32 KB

Contents

module Blather
class Stanza
class PubSubOwner

  # # PubSubOwner Delete Stanza
  #
  # [XEP-0060 Section 8.4 Delete a Node](http://xmpp.org/extensions/xep-0060.html#owner-delete)
  #
  # @handler :pubsub_delete
  class Delete < PubSubOwner
    register :pubsub_delete, :delete, self.registered_ns

    # Create a new delete stanza
    #
    # @param [Blather::Stanza::Iq::VALID_TYPES] type the IQ stanza type
    # @param [String] host the host to send the request to
    # @param [String] node the name of the node to delete
    def self.new(type = :set, host = nil, node = nil)
      new_node = super(type, host)
      new_node.node = node
      new_node
    end

    # Get the name of the node to delete
    #
    # @return [String]
    def node
      delete_node[:node]
    end

    # Set the name of the node to delete
    #
    # @param [String] node
    def node=(node)
      delete_node[:node] = node
    end

    # Get or create the actual delete node on the stanza
    #
    # @return [Blather::XMPPNode]
    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
  end  # Retract

end  # PubSub
end  # Stanza
end  # Blather

Version data entries

48 entries across 48 versions & 3 rubygems

Version Path
blather-2.0.0 lib/blather/stanza/pubsub_owner/delete.rb
blather-1.2.0 lib/blather/stanza/pubsub_owner/delete.rb
blather-1.1.4 lib/blather/stanza/pubsub_owner/delete.rb
blather-1.1.3 lib/blather/stanza/pubsub_owner/delete.rb
blather-1.1.2 lib/blather/stanza/pubsub_owner/delete.rb
blather-1.1.1 lib/blather/stanza/pubsub_owner/delete.rb
blather-1.1.0 lib/blather/stanza/pubsub_owner/delete.rb
blather-1.0.0 lib/blather/stanza/pubsub_owner/delete.rb
blather-0.8.8 lib/blather/stanza/pubsub_owner/delete.rb
blather-0.8.7 lib/blather/stanza/pubsub_owner/delete.rb
blather-0.8.6 lib/blather/stanza/pubsub_owner/delete.rb
blather-0.8.5 lib/blather/stanza/pubsub_owner/delete.rb
blather-0.8.4 lib/blather/stanza/pubsub_owner/delete.rb
blather-0.8.3 lib/blather/stanza/pubsub_owner/delete.rb
blather-0.8.2 lib/blather/stanza/pubsub_owner/delete.rb
tp-blather-0.8.5 lib/blather/stanza/pubsub_owner/delete.rb
tp-blather-0.8.4 lib/blather/stanza/pubsub_owner/delete.rb
tp-blather-0.8.3 lib/blather/stanza/pubsub_owner/delete.rb
tp-blather-0.8.2 lib/blather/stanza/pubsub_owner/delete.rb
blather-0.8.1 lib/blather/stanza/pubsub_owner/delete.rb