Class: Blather::Stanza::Presence::Subscription
- Inherits:
-
Blather::Stanza::Presence
- Object
- Nokogiri::XML::Node
- XMPPNode
- Blather::Stanza
- Blather::Stanza::Presence
- Blather::Stanza::Presence::Subscription
- Defined in:
- lib/blather/stanza/presence/subscription.rb
Constant Summary
Constants inherited from Blather::Stanza::Presence
Constants inherited from XMPPNode
Class Method Summary collapse
Instance Method Summary collapse
-
#approve! ⇒ Object
Create an approve stanza.
-
#cancel! ⇒ Object
Create a cancel stanza.
- #inherit(node) ⇒ Object
-
#refuse! ⇒ Object
Create a refuse stanza.
-
#request! ⇒ Object
Create a request stanza.
- #request? ⇒ Boolean
- #to=(to) ⇒ Object
-
#unsubscribe! ⇒ Object
Create an unsubscribe stanza.
Methods inherited from Blather::Stanza::Presence
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_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(to = nil, type = nil) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/blather/stanza/presence/subscription.rb', line 8 def self.new(to = nil, type = nil) node = super() node.to = to node.type = type node end |
Instance Method Details
#approve! ⇒ Object
Create an approve stanza
26 27 28 29 |
# File 'lib/blather/stanza/presence/subscription.rb', line 26 def approve! self.type = :subscribed reply_if_needed! end |
#cancel! ⇒ Object
Create a cancel stanza
47 48 49 50 |
# File 'lib/blather/stanza/presence/subscription.rb', line 47 def cancel! self.type = :unsubscribed reply_if_needed! end |
#inherit(node) ⇒ Object
15 16 17 18 |
# File 'lib/blather/stanza/presence/subscription.rb', line 15 def inherit(node) inherit_attrs node.attributes self end |
#refuse! ⇒ Object
Create a refuse stanza
33 34 35 36 |
# File 'lib/blather/stanza/presence/subscription.rb', line 33 def refuse! self.type = :unsubscribed reply_if_needed! end |
#request! ⇒ Object
Create a request stanza
54 55 56 57 |
# File 'lib/blather/stanza/presence/subscription.rb', line 54 def request! self.type = :subscribe reply_if_needed! end |
#request? ⇒ Boolean
59 60 61 |
# File 'lib/blather/stanza/presence/subscription.rb', line 59 def request? self.type == :subscribe end |
#to=(to) ⇒ Object
20 21 22 |
# File 'lib/blather/stanza/presence/subscription.rb', line 20 def to=(to) super JID.new(to).stripped end |
#unsubscribe! ⇒ Object
Create an unsubscribe stanza
40 41 42 43 |
# File 'lib/blather/stanza/presence/subscription.rb', line 40 def unsubscribe! self.type = :unsubscribe reply_if_needed! end |