Sha256: 51bf1581963447276dbc6d818d1702cb6ac82fa74febd9ca3e105494c920b1f6

Contents?: true

Size: 1.04 KB

Versions: 13

Compression:

Stored size: 1.04 KB

Contents

module Blather
class Stanza
class PubSub

  class Create < PubSub
    register :pubsub_create, :create, self.registered_ns

    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

    def node
      create_node[:node]
    end

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

    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

    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
  end #Retract

end #PubSub
end #Stanza
end #Blather

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
sprsquish-blather-0.4.0 lib/blather/stanza/pubsub/create.rb
sprsquish-blather-0.4.1 lib/blather/stanza/pubsub/create.rb
sprsquish-blather-0.4.2 lib/blather/stanza/pubsub/create.rb
sprsquish-blather-0.4.3 lib/blather/stanza/pubsub/create.rb
sprsquish-blather-0.4.4 lib/blather/stanza/pubsub/create.rb
blather-0.4.7 lib/blather/stanza/pubsub/create.rb
blather-0.4.6 lib/blather/stanza/pubsub/create.rb
blather-0.4.5 lib/blather/stanza/pubsub/create.rb
blather-0.4.4 lib/blather/stanza/pubsub/create.rb
blather-0.4.3 lib/blather/stanza/pubsub/create.rb
blather-0.4.0 lib/blather/stanza/pubsub/create.rb
blather-0.4.2 lib/blather/stanza/pubsub/create.rb
blather-0.4.1 lib/blather/stanza/pubsub/create.rb