Class: AgentXmpp::Xmpp::IqPublish
- Inherits:
-
Element
- Object
- REXML::Element
- Element
- AgentXmpp::Xmpp::IqPublish
- Defined in:
- lib/agent_xmpp/xmpp/iq_pubsub.rb
Overview
Class Method Summary collapse
-
.set(pipe, args) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
Instance Method Summary collapse
-
#initialize(node = nil) ⇒ IqPublish
constructor
.….….….….….….….….….….….….….….….….….….….….….….….….….….
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(node = nil) ⇒ IqPublish
.….….….….….….….….….….….….….….….….….….….….….….….….….….
171 172 173 174 |
# File 'lib/agent_xmpp/xmpp/iq_pubsub.rb', line 171 def initialize(node=nil) super() self.node = node if node end |
Class Method Details
.set(pipe, args) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/agent_xmpp/xmpp/iq_pubsub.rb', line 153 def set(pipe, args) iq = Xmpp::Iq.new(:set, args[:to]) item = Item.new << args[:payload] pub = IqPublish.new("#{AgentXmpp.user_pubsub_root}/#{args[:node]}") << item iq.pubsub = IqPubSub.new << pub Send(iq) do |r| if r.type == :result and r.kind_of?(Xmpp::Iq) pipe.broadcast_to_delegates(:on_publish_result, pipe, r, args[:node]) elsif r.type.eql?(:error) pipe.broadcast_to_delegates(:on_publish_error, pipe, r, args[:node]) end end end |