Class: Jabber::Version::IqQueryVersion

Class | Jabber::Version::IqQueryVersion
In: | lib/xmpp4r/version/iq/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

### Methods

iname iname= new os os= set_iname set_os set_version version version=

### Public Class methods

new(iname=nil, version=nil, os=nil)

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

### Public Instance methods

iname()

Get the name of the software

This has been renamed to ‘iname’ here to keep REXML::Element#name accessible

[Source]

        # File lib/xmpp4r/version/iq/version.rb, line 32
    32:       def iname
    33:         first_element_text('name')
    34:       end

iname=(text)

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.

[Source]

        # File lib/xmpp4r/version/iq/version.rb, line 42
    42:       def iname=(text)
    43:         replace_element_text('name', text.nil? ? '' : text)
    44:       end

os()

Get the operating system or nil (os is not mandatory for Version Query)

[Source]

        # File lib/xmpp4r/version/iq/version.rb, line 81
    81:       def os
    82:         first_element_text('os')
    83:       end

os=(text)

Set the os of the software

text: | [String] or nil

[Source]

        # 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_iname(text)

Set the name of the software (chaining-friendly)

result: | [String] or nil

[Source]

        # File lib/xmpp4r/version/iq/version.rb, line 49
    49:       def set_iname(text)
    50:         self.iname = text
    51:         self
    52:       end

set_os(text)

Set the os of the software (chaining-friendly)

text: | [String] or nil

[Source]

         # File lib/xmpp4r/version/iq/version.rb, line 99
     99:       def set_os(text)
    100:         self.os = text
    101:         self
    102:       end

set_version(text)

Set the version of the software (chaining-friendly)

text: | [String]

[Source]

        # File lib/xmpp4r/version/iq/version.rb, line 73
    73:       def set_version(text)
    74:         self.version = text
    75:         self
    76:       end

version()

Get the version of the software

result: | [String] or nil

[Source]

        # File lib/xmpp4r/version/iq/version.rb, line 57
    57:       def version
    58:         first_element_text('version')
    59:       end

version=(text)

Set the version of the software

The element won‘t be deleted if text is nil as it must occur in a version query

[Source]

        # File lib/xmpp4r/version/iq/version.rb, line 66
    66:       def version=(text)
    67:         replace_element_text('version', text.nil? ? '' : text)
    68:       end

[Validate]