Class: Blather::Stanza::Iq::Vcard
- Inherits:
-
Blather::Stanza::Iq
- Object
- Nokogiri::XML::Node
- XMPPNode
- Blather::Stanza
- Blather::Stanza::Iq
- Blather::Stanza::Iq::Vcard
- Defined in:
- lib/blather/stanza/iq/vcard.rb
Overview
# Vcard Stanza
[XEP-0054 vcard-temp](xmpp.org/extensions/xep-0054.html)
This is a base class for any vcard based Iq stanzas. It provides a base set of methods for working with vcard stanzas
Defined Under Namespace
Classes: Vcard
Constant Summary
Constants inherited from Blather::Stanza::Iq
Constants inherited from XMPPNode
Class Method Summary collapse
-
.new(type = nil, to = nil, id = nil) ⇒ Object
Overrides the parent method to ensure a vcard node is created.
Instance Method Summary collapse
-
#inherit(node) ⇒ Object
Overrides the parent method to ensure the current vcard node is destroyed.
-
#vcard ⇒ Vcard::Vcard
Find or create vcard node.
-
#vcard=(info) ⇒ Vcard::Vcard
Replaces vcard node.
Methods inherited from Blather::Stanza::Iq
#error?, #get?, import, #reply!, #result?, #set?, #type=
Methods inherited from Blather::Stanza
#as_error, #error?, #from, #from=, handler_list, #id, #id=, next_id, register, #reply, #reply!, #to, #to=, #type, #type=
Methods inherited from XMPPNode
class_from_registration, #content_from, import, #inherit_attrs, #inspect, #namespace=, #namespace_href, #nokogiri_namespace=, #read_attr, #read_content, register, #remove_child, #remove_children, #set_content_for, #to_stanza, #write_attr
Methods inherited from Nokogiri::XML::Node
#[]=, #attr_set, #find_first, #nokogiri_xpath, #xpath
Class Method Details
.new(type = nil, to = nil, id = nil) ⇒ Object
Overrides the parent method to ensure a vcard node is created
39 40 41 42 43 |
# File 'lib/blather/stanza/iq/vcard.rb', line 39 def self.new(type = nil, to = nil, id = nil) node = super node.vcard node end |
Instance Method Details
#inherit(node) ⇒ Object
Overrides the parent method to ensure the current vcard node is destroyed
48 49 50 51 52 |
# File 'lib/blather/stanza/iq/vcard.rb', line 48 def inherit(node) vcard.remove super self end |
#vcard ⇒ Vcard::Vcard
Find or create vcard node
57 58 59 |
# File 'lib/blather/stanza/iq/vcard.rb', line 57 def vcard Vcard.find_or_create self end |
#vcard=(info) ⇒ Vcard::Vcard
Replaces vcard node
66 67 68 69 70 |
# File 'lib/blather/stanza/iq/vcard.rb', line 66 def vcard=(info) vcard.remove self << info Vcard.find_or_create self end |