Class: AgentXmpp::Xmpp::Subscription
- Inherits:
-
Element
- Object
- REXML::Element
- Element
- AgentXmpp::Xmpp::Subscription
- Defined in:
- lib/agent_xmpp/xmpp/iq_pubsub.rb
Overview
Instance Method Summary collapse
-
#initialize(jid = nil, node = nil, subid = nil, subscription = nil) ⇒ Subscription
constructor
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
#jid ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
#jid=(myjid) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
#need_approval? ⇒ Boolean
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
#state ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
#state=(mystate) ⇒ 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, node = nil, subid = nil, subscription = nil) ⇒ Subscription
.….….….….….….….….….….….….….….….….….….….….….….….….….….
227 228 229 230 231 232 233 |
# File 'lib/agent_xmpp/xmpp/iq_pubsub.rb', line 227 def initialize(jid=nil, node=nil, subid=nil, subscription=nil) super() self.jid = jid if jid self.node = node if node self.subid = subid if subid self.state = subscription if subscription end |
Instance Method Details
#jid ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
236 237 238 |
# File 'lib/agent_xmpp/xmpp/iq_pubsub.rb', line 236 def jid (a = attribute('jid')).nil? ? a : Jid.new(a.value) end |
#jid=(myjid) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
241 242 243 |
# File 'lib/agent_xmpp/xmpp/iq_pubsub.rb', line 241 def jid=(myjid) add_attribute('jid', myjid ? myjid.to_s : nil) end |
#need_approval? ⇒ Boolean
.….….….….….….….….….….….….….….….….….….….….….….….….….….
257 258 259 |
# File 'lib/agent_xmpp/xmpp/iq_pubsub.rb', line 257 def need_approval? state == :pending end |
#state ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
246 247 248 249 |
# File 'lib/agent_xmpp/xmpp/iq_pubsub.rb', line 246 def state sub = attributes['subscription'] ['none', 'pending', 'subscribed', 'unconfigured'].include?(sub) ? sub.to_sym : nil end |
#state=(mystate) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
252 253 254 |
# File 'lib/agent_xmpp/xmpp/iq_pubsub.rb', line 252 def state=(mystate) attributes['subscription'] = mystate end |