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
[Source]
# File lib/xmpp4r/version/iq/version.rb, line 20 20: def initialize(iname=nil, version=nil, os=nil) 21: super() 22: set_iname(iname) if iname 23: set_version(version) if version 24: set_os(os) if os 25: end
Get the name of the software
This has been renamed to ‘iname’ here to keep REXML::Element#name accessible
# File lib/xmpp4r/version/iq/version.rb, line 32 32: def iname 33: first_element_text('name') 34: 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/version/iq/version.rb, line 42 42: def iname=(text) 43: replace_element_text('name', text.nil? ? '' : text) 44: end
Get the operating system or nil (os is not mandatory for Version Query)
# File lib/xmpp4r/version/iq/version.rb, line 81 81: def os 82: first_element_text('os') 83: end
Set the os of the software
# File lib/xmpp4r/version/iq/version.rb, line 88 88: def os=(text) 89: if text 90: replace_element_text('os', text) 91: else 92: delete_elements('os') 93: end 94: end
Set the name of the software (chaining-friendly)
# File lib/xmpp4r/version/iq/version.rb, line 49 49: def set_iname(text) 50: self.iname = text 51: self 52: end
Set the os of the software (chaining-friendly)
# File lib/xmpp4r/version/iq/version.rb, line 99 99: def set_os(text) 100: self.os = text 101: self 102: end
Set the version of the software (chaining-friendly)
# File lib/xmpp4r/version/iq/version.rb, line 73 73: def set_version(text) 74: self.version = text 75: self 76: end
Get the version of the software
# File lib/xmpp4r/version/iq/version.rb, line 57 57: def version 58: first_element_text('version') 59: end
Set the version of the software
The element won‘t be deleted if text is nil as it must occur in a version query
# File lib/xmpp4r/version/iq/version.rb, line 66 66: def version=(text) 67: replace_element_text('version', text.nil? ? '' : text) 68: end
[Validate]