Sha256: 9283a6c9f4f52f1cef1d6eec1aa940d63c502288b473328e447984547fa93d8c

Contents?: true

Size: 879 Bytes

Versions: 13

Compression:

Stored size: 879 Bytes

Contents

module Blather
class Stanza
class PubSub

  class Unsubscribe < PubSub
    register :pubsub_unsubscribe, :unsubscribe, self.registered_ns

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

    def jid
      JID.new(unsubscribe[:jid])
    end

    def jid=(jid)
      unsubscribe[:jid] = jid
    end

    def node
      unsubscribe[:node]
    end

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

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

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/unsubscribe.rb
sprsquish-blather-0.4.1 lib/blather/stanza/pubsub/unsubscribe.rb
sprsquish-blather-0.4.2 lib/blather/stanza/pubsub/unsubscribe.rb
sprsquish-blather-0.4.3 lib/blather/stanza/pubsub/unsubscribe.rb
sprsquish-blather-0.4.4 lib/blather/stanza/pubsub/unsubscribe.rb
blather-0.4.7 lib/blather/stanza/pubsub/unsubscribe.rb
blather-0.4.6 lib/blather/stanza/pubsub/unsubscribe.rb
blather-0.4.5 lib/blather/stanza/pubsub/unsubscribe.rb
blather-0.4.4 lib/blather/stanza/pubsub/unsubscribe.rb
blather-0.4.3 lib/blather/stanza/pubsub/unsubscribe.rb
blather-0.4.2 lib/blather/stanza/pubsub/unsubscribe.rb
blather-0.4.1 lib/blather/stanza/pubsub/unsubscribe.rb
blather-0.4.0 lib/blather/stanza/pubsub/unsubscribe.rb