Class: Blather::Stanza::DiscoInfo
- Inherits:
-
Disco
- Object
- Nokogiri::XML::Node
- XMPPNode
- Blather::Stanza
- Iq
- Iq::Query
- Disco
- Blather::Stanza::DiscoInfo
- Defined in:
- lib/blather/stanza/disco/disco_info.rb
Overview
# DiscoInfo Stanza
[XEP-0030 Disco Info](xmpp.org/extensions/xep-0030.html#info)
Disco Info node that provides or retreives information about a jabber entity
Defined Under Namespace
Constant Summary
Constants inherited from Iq
Constants inherited from XMPPNode
Class Method Summary collapse
-
.new(type = nil, node = nil, identities = [], features = []) ⇒ DiscoInfo
Create a new DiscoInfo stanza identities.
Instance Method Summary collapse
-
#features ⇒ Object
List of feature objects.
-
#features=(features) ⇒ Object
Add an array of features.
-
#identities ⇒ Object
List of identity objects.
-
#identities=(identities) ⇒ Object
Add an array of identities.
Methods inherited from Disco
Methods inherited from Iq::Query
Methods inherited from 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, #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, node = nil, identities = [], features = []) ⇒ DiscoInfo
Create a new DiscoInfo stanza identities. these are passed directly to DiscoInfo::Identity.new features. these are passed directly to DiscoInfo::Feature.new
22 23 24 25 26 27 28 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 22 def self.new(type = nil, node = nil, identities = [], features = []) new_node = super type new_node.node = node new_node.identities = [identities] new_node.features = [features] new_node end |
Instance Method Details
#features ⇒ Object
List of feature objects
47 48 49 50 51 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 47 def features query.find('//ns:feature', :ns => self.class.registered_ns).map do |f| Feature.new f end end |
#features=(features) ⇒ Object
Add an array of features
55 56 57 58 59 60 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 55 def features=(features) query.find('//ns:feature', :ns => self.class.registered_ns).each &:remove if features [features].flatten.each { |f| self.query << Feature.new(f) } end end |
#identities ⇒ Object
List of identity objects
31 32 33 34 35 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 31 def identities query.find('//ns:identity', :ns => self.class.registered_ns).map do |i| Identity.new i end end |
#identities=(identities) ⇒ Object
Add an array of identities
39 40 41 42 43 44 |
# File 'lib/blather/stanza/disco/disco_info.rb', line 39 def identities=(identities) query.find('//ns:identity', :ns => self.class.registered_ns).each &:remove if identities [identities].flatten.each { |i| self.query << Identity.new(i) } end end |