class Blather::Stanza::DiscoItems
[XEP-0030 Disco
Info](xmpp.org/extensions/xep-0030.html#items)
Disco
Items node that provides or retreives items associated with a jabbery entity
@handler :disco_items
Public Class Methods
new(type = nil, node = nil, items = [])
click to toggle source
Create a new DiscoItems
node
@param [#to_s] type the IQ type @param [#to_s] node the node the items are associated with @param [Array<Blather::XMPPNode>] items an array of Disco::Items @return [Blather::Stanza::DiscoItems]
Calls superclass method
# 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
Public Instance Methods
items()
click to toggle source
Set of items associated with the node
@return [Array<Blather::Stanza::DiscoItems::Item>]
# 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
items=(items)
click to toggle source
Add an array of items @param items the array of items, passed directly to Item.new
# File lib/blather/stanza/disco/disco_items.rb, line 39 def items=(items) query.find('//ns:item', :ns => self.class.registered_ns).each &:remove if items [items].flatten.each { |i| self.query << Item.new(i) } end end