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, state = 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, state = nil) ⇒ Subscription
.….….….….….….….….….….….….….….….….….….….….….….….….….….
229 230 231 232 233 234 235 |
# File 'lib/agent_xmpp/xmpp/iq_pubsub.rb', line 229 def initialize(jid=nil, node=nil, subid=nil, state=nil) super() self.jid = jid if jid self.node = node if node self.subid = subid if subid self.state = state if state end |
Instance Method Details
#jid ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
238 239 240 |
# File 'lib/agent_xmpp/xmpp/iq_pubsub.rb', line 238 def jid (a = attribute('jid')).nil? ? a : Jid.new(a.value) end |
#jid=(myjid) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
243 244 245 |
# File 'lib/agent_xmpp/xmpp/iq_pubsub.rb', line 243 def jid=(myjid) add_attribute('jid', myjid ? myjid.to_s : nil) end |
#need_approval? ⇒ Boolean
.….….….….….….….….….….….….….….….….….….….….….….….….….….
259 260 261 |
# File 'lib/agent_xmpp/xmpp/iq_pubsub.rb', line 259 def need_approval? state == :pending end |
#state ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
248 249 250 251 |
# File 'lib/agent_xmpp/xmpp/iq_pubsub.rb', line 248 def state sub = attributes['subscription'] ['none', 'pending', 'subscribed', 'unconfigured'].include?(sub) ? sub.to_sym : nil end |
#state=(mystate) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
254 255 256 |
# File 'lib/agent_xmpp/xmpp/iq_pubsub.rb', line 254 def state=(mystate) attributes['subscription'] = mystate end |