Class: AgentXmpp::Xmpp::IqVersion
- Inherits:
-
IqQuery
- Object
- REXML::Element
- Element
- IqQuery
- AgentXmpp::Xmpp::IqVersion
- Defined in:
- lib/agent_xmpp/xmpp/iq_version.rb
Overview
.......................................................................................................
Class Method Summary (collapse)
-
+ (Object) get(pipe, contact_jid)
.........................................................................................................
-
+ (Object) result(pipe, request)
.........................................................................................................
Instance Method Summary (collapse)
-
- (Object) iname
.......................................................................................................
-
- (Object) iname=(text)
.......................................................................................................
-
- (IqVersion) initialize(iname = nil, version = nil, os = nil)
constructor
.......................................................................................................
-
- (Object) os
.......................................................................................................
-
- (Object) os=(text)
.......................................................................................................
-
- (Object) version
.......................................................................................................
-
- (Object) version=(text)
.......................................................................................................
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
- (IqVersion) initialize(iname = nil, version = nil, os = nil)
.......................................................................................................
45 46 47 48 49 50 |
# File 'lib/agent_xmpp/xmpp/iq_version.rb', line 45 def initialize(iname=nil, version=nil, os=nil) super() self.iname = iname if iname self.version = version if version self.os = os if os end |
Class Method Details
+ (Object) get(pipe, contact_jid)
.........................................................................................................
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/agent_xmpp/xmpp/iq_version.rb', line 18 def get(pipe, contact_jid) iq = Xmpp::Iq.new(:get, contact_jid) iq.query = new Send(iq) do |r| if (r.type == :result) && r.query.kind_of?(Xmpp::IqVersion) pipe.broadcast_to_delegates(:on_version_result, pipe, r) elsif r.type.eql?(:error) pipe.broadcast_to_delegates(:on_version_error, pipe, r) end end end |
+ (Object) result(pipe, request)
.........................................................................................................
31 32 33 34 35 36 37 38 39 |
# File 'lib/agent_xmpp/xmpp/iq_version.rb', line 31 def result(pipe, request) iq = Xmpp::Iq.new(:result, request.from.to_s) iq.id = request.id unless request.id.nil? iq.query = new iq.query.iname = AgentXmpp::AGENT_XMPP_NAME iq.query.version = AgentXmpp::VERSION iq.query.os = AgentXmpp::OS_VERSION Send(iq) end |
Instance Method Details
- (Object) iname
.......................................................................................................
53 54 55 |
# File 'lib/agent_xmpp/xmpp/iq_version.rb', line 53 def iname first_element_text('name') end |
- (Object) iname=(text)
.......................................................................................................
58 59 60 |
# File 'lib/agent_xmpp/xmpp/iq_version.rb', line 58 def iname=(text) replace_element_text('name', text.nil? ? '' : text) end |
- (Object) os
.......................................................................................................
73 74 75 |
# File 'lib/agent_xmpp/xmpp/iq_version.rb', line 73 def os first_element_text('os') end |
- (Object) os=(text)
.......................................................................................................
78 79 80 |
# File 'lib/agent_xmpp/xmpp/iq_version.rb', line 78 def os=(text) replace_element_text('os', text.nil? ? '' : text) end |
- (Object) version
.......................................................................................................
63 64 65 |
# File 'lib/agent_xmpp/xmpp/iq_version.rb', line 63 def version first_element_text('version') end |
- (Object) version=(text)
.......................................................................................................
68 69 70 |
# File 'lib/agent_xmpp/xmpp/iq_version.rb', line 68 def version=(text) replace_element_text('version', text.nil? ? '' : text) end |