class Blather::Stanza::Iq::Roster
[RFC 3921 Section 7 - Roster
Management](xmpp.org/rfcs/rfc3921.html#roster)
@handler :roster
Public Class Methods
new(type = nil, item = nil)
click to toggle source
Create a new roster stanza and (optionally) load it with an item
@param [<Blather::Stanza::Iq::VALID_TYPES>] type the stanza type @param [Blather::XMPPNode] item a roster item
Calls superclass method
Blather::Stanza::Iq::Query::new
# File lib/blather/stanza/iq/roster.rb, line 17 def self.new(type = nil, item = nil) node = super type node.query << item if item node end
Public Instance Methods
inherit(node)
click to toggle source
Inherit the XMPPNode
to create a proper Roster
object. Creates RosterItem
objects out of each roster item as well.
@param [Blather::XMPPNode] node a node to inherit
Calls superclass method
Blather::Stanza::Iq::Query#inherit
# File lib/blather/stanza/iq/roster.rb, line 27 def inherit(node) # remove the current set of nodes remove_children :item super # transmogrify nodes into RosterItems items.each { |i| query << RosterItem.new(i); i.remove } self end
items()
click to toggle source
The list of roster items
@return [Array<Blather::Stanza::Iq::Roster::RosterItem>]
# File lib/blather/stanza/iq/roster.rb, line 39 def items query.find('//ns:item', :ns => self.class.registered_ns).map do |i| RosterItem.new i end end
version()
click to toggle source
The provided roster version if available
@return [String]
# File lib/blather/stanza/iq/roster.rb, line 48 def version query[:ver] end