Sha256: 534361c52a61ceb8f2170dee1c5cf23db6e0ea237041d5504033f01e0922fe4b
Contents?: true
Size: 1.98 KB
Versions: 2
Compression:
Stored size: 1.98 KB
Contents
module Blather class Stanza class Iq ## # DiscoInfo object () # class DiscoInfo < Disco register :disco_info, nil, 'http://jabber.org/protocol/disco#info' def initialize(type = nil, identities = [], features = [], node = nil) super type [identities].flatten.each do |id| query << (id.is_a?(Identity) ? id : Identity.new(id[:name], id[:type], id[:category])) end [features].flatten.each do |feature| query << (feature.is_a?(Feature) ? feature : Feature.new(feature)) end self.node = node end ## # List of identity objects def identities identities = query.find('identity') identities = query.find('query_ns:identity', :query_ns => self.class.ns) if identities.empty? identities.map { |i| Identity.new i } end ## # List of feature objects def features features = query.find('feature') features = query.find('query_ns:feature', :query_ns => self.class.ns) if features.empty? features.map { |i| Feature.new i } end class Identity < XMPPNode attribute_accessor :category, :type attribute_accessor :name, :to_sym => false def initialize(name, type = nil, category = nil) super :identity if name.is_a?(XML::Node) self.inherit name else self.name = name self.type = type self.category = category end end def eql?(other) other.kind_of?(self.class) && other.name == self.name && other.type == self.type && other.category == self.category end end class Feature < XMPPNode attribute_accessor :var, :to_sym => false def initialize(var) super :feature if var.is_a?(XML::Node) self.inherit var else self.var = var end end def eql?(other) other.kind_of?(self.class) && other.var == self.var end end end end #Iq end #Stanza end #Blather
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
sprsquish-blather-0.2.3 | lib/blather/stanza/iq/discos/disco_info.rb |
blather-0.2.3 | lib/blather/stanza/iq/discos/disco_info.rb |