Class: AgentXmpp::Xmpp::RosterItem
- Inherits:
-
Element
- Object
- REXML::Element
- Element
- AgentXmpp::Xmpp::RosterItem
- Defined in:
- lib/agent_xmpp/xmpp/iq_roster.rb
Overview
Instance Method Summary collapse
-
#ask ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#ask=(val) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#groups ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#groups=(ary) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#iname ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#iname=(val) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#initialize(jid = nil, iname = nil, subscription = nil, ask = nil) ⇒ RosterItem
constructor
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#jid ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
-
#jid=(val) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
Methods inherited from Element
#<<, class_for_name_xmlns, #clone, import, name_xmlns, name_xmlns_for_class, #parent=, #set_xml_lang, #typed_add, #xml_lang, #xml_lang=, xmpp_attribute, xmpp_child
Methods inherited from REXML::Element
#delete_elements, #first_element, #first_element_text, #import, import, #replace_element_text, #typed_add
Constructor Details
#initialize(jid = nil, iname = nil, subscription = nil, ask = nil) ⇒ RosterItem
.….….….….….….….….….….….….….….….….….….….….….….….….……
120 121 122 123 124 125 126 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 120 def initialize(jid=nil, iname=nil, subscription=nil, ask=nil) super() self.jid = jid self.iname = iname if iname self.subscription = subscription if subscription self.ask = ask if ask end |
Instance Method Details
#ask ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
149 150 151 152 153 154 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 149 def ask case attributes['ask'] when 'subscribe' then :subscribe else :none end end |
#ask=(val) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
157 158 159 160 161 162 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 157 def ask=(val) case val when :subscribe then attributes['ask'] = 'subscribe' else attributes['ask'] = nil end end |
#groups ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
165 166 167 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 165 def groups elements.inject('group', []) {|r, g| r << g.text}.uniq end |
#groups=(ary) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
170 171 172 173 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 170 def groups=(ary) delete_elements('group') ary.uniq.each{|group| add_element('group').text = group} end |
#iname ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
129 130 131 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 129 def iname attributes['name'] end |
#iname=(val) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
134 135 136 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 134 def iname=(val) attributes['name'] = val end |
#jid ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
139 140 141 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 139 def jid (a = attributes['jid']) ? Jid.new(a) : nil end |
#jid=(val) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….……
144 145 146 |
# File 'lib/agent_xmpp/xmpp/iq_roster.rb', line 144 def jid=(val) attributes['jid'] = val.nil? ? nil : val.to_s end |