Class: AgentXmpp::Xmpp::IqCommand

Inherits:
Element show all
Defined in:
lib/agent_xmpp/xmpp/iq_command.rb

Overview


Class Method Summary collapse

Instance Method Summary collapse

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, action = nil) ⇒ IqCommand

.….….….….….….….….….….….….….….….….….….….….….….….….….



34
35
36
37
38
# File 'lib/agent_xmpp/xmpp/iq_command.rb', line 34

def initialize(node=nil, action=nil)
  super()
  self.node = node if node
  self.action = action if action
end

Class Method Details

.result(args) ⇒ Object

.….….….….….….….….….….….….….….….….….….….….….….….….….….



21
22
23
24
25
26
27
28
# File 'lib/agent_xmpp/xmpp/iq_command.rb', line 21

def result(args)
  iq = Iq.new(:result, args[:to])
  iq.id = args[:id] unless args[:id].nil?
  iq.command = new(args[:node])
  iq.command.status = 'completed'
  iq.command << args[:payload] unless args[:payload].nil?
  Send(iq)      
end