Class: Blather::Stanza::PubSub::Unsubscribe

Inherits:
Blather::Stanza::PubSub show all
Defined in:
lib/blather/stanza/pubsub/unsubscribe.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, jid = nil) ⇒ Object



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

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

Instance Method Details

#jidObject



15
16
17
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 15

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

#jid=(jid) ⇒ Object



19
20
21
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 19

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

#nodeObject



23
24
25
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 23

def node
  unsubscribe[:node]
end

#node=(node) ⇒ Object



27
28
29
# File 'lib/blather/stanza/pubsub/unsubscribe.rb', line 27

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

#unsubscribeObject



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

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