Class | Jabber::IqQueryVersion |
In: |
lib/xmpp4r/iq/query/version.rb
|
Parent: | IqQuery |
Class for handling queries for ‘Software Version’ (JEP 0092)
Notice that according to JEP 0092 only the <os/> element can be omitted, <name/> (iname) and <version/> must be present
Create a new <query xmlns=’jabber:iq:version’/> element
# File lib/xmpp4r/iq/query/version.rb, line 17 17: def initialize(iname='', version='', os=nil) 18: super() 19: add_namespace('jabber:iq:version') 20: set_iname(iname) 21: set_version(version) 22: set_os(os) 23: end
Import an element, deletes <name/>, <version/> and <os/> elements first
xe: | [REXML::Element] |
# File lib/xmpp4r/iq/query/version.rb, line 29 29: def import(xe) 30: delete_element('name') 31: delete_element('version') 32: delete_element('os') 33: super 34: end
Get the name of the software
This has been renamed to ‘iname’ here to keep REXML::Element#name accessible
# File lib/xmpp4r/iq/query/version.rb, line 41 41: def iname 42: first_element_text('name') 43: end
Set the name of the software
The element won’t be deleted if text is nil as it must occur in a version query, but its text will be empty.
# File lib/xmpp4r/iq/query/version.rb, line 51 51: def iname=(text) 52: replace_element_text('name', text.nil? ? '' : text) 53: end
Get the operating system or nil (os is not mandatory for Version Query)
# File lib/xmpp4r/iq/query/version.rb, line 90 90: def os 91: first_element_text('os') 92: end
Set the os of the software
text: | [String] or nil |
# File lib/xmpp4r/iq/query/version.rb, line 97 97: def os=(text) 98: if text 99: replace_element_text('os', text) 100: else 101: delete_elements('os') 102: end 103: end
Set the name of the software (chaining-friendly)
result: | [String] or nil |
# File lib/xmpp4r/iq/query/version.rb, line 58 58: def set_iname(text) 59: self.iname = text 60: self 61: end
Set the os of the software (chaining-friendly)
text: | [String] or nil |
# File lib/xmpp4r/iq/query/version.rb, line 108 108: def set_os(text) 109: self.os = text 110: self 111: end
Set the version of the software (chaining-friendly)
text: | [String] |
# File lib/xmpp4r/iq/query/version.rb, line 82 82: def set_version(text) 83: self.version = text 84: self 85: end
Get the version of the software
result: | [String] or nil |
# File lib/xmpp4r/iq/query/version.rb, line 66 66: def version 67: first_element_text('version') 68: end