Class: Blather::Stanza::DiscoItems
- Inherits:
-
Disco
- Object
- Nokogiri::XML::Node
- XMPPNode
- Blather::Stanza
- Iq
- Iq::Query
- Disco
- Blather::Stanza::DiscoItems
- Defined in:
- lib/blather/stanza/disco/disco_items.rb
Overview
# DiscoItems Stanza
[XEP-0030 Disco Info](xmpp.org/extensions/xep-0030.html#items)
Disco Items node that provides or retreives items associated with a jabbery entity
Defined Under Namespace
Classes: Item
Constant Summary
Constants inherited from Iq
Constants inherited from XMPPNode
Class Method Summary collapse
-
.new(type = nil, node = nil, items = []) ⇒ Blather::Stanza::DiscoItems
Create a new DiscoItems node.
Instance Method Summary collapse
-
#items ⇒ Array<Blather::Stanza::DiscoItems::Item>
Set of items associated with the node.
-
#items=(items) ⇒ Object
Add an array of items.
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, items = []) ⇒ Blather::Stanza::DiscoItems
Create a new DiscoItems node
21 22 23 24 25 26 |
# File 'lib/blather/stanza/disco/disco_items.rb', line 21 def self.new(type = nil, node = nil, items = []) new_node = super type new_node.node = node new_node.items = [items] new_node end |
Instance Method Details
#items ⇒ Array<Blather::Stanza::DiscoItems::Item>
Set of items associated with the node
31 32 33 34 35 |
# File 'lib/blather/stanza/disco/disco_items.rb', line 31 def items query.find('//ns:item', :ns => self.class.registered_ns).map do |i| Item.new i end end |