Class: Jabber::Discovery::Identity

Inherits:
REXML::Element show all
Defined in:
lib/xmpp4r/discovery/iq/discoinfo.rb

Overview

Service Discovery identity to add() to IqQueryDiscoInfo

Please note that JEP 0030 requires both category and type to occur

Instance Method Summary collapse

Methods inherited from REXML::Element

#delete_elements, #first_element, #first_element_text, #import, import, #replace_element_text, #typed_add

Constructor Details

#initialize(category = nil, iname = nil, type = nil) ⇒ Identity

Initialize a new Identity

category
String

Initial category or nil

iname
String

Initial identity name or nil

type
String

Initial type or nil



103
104
105
106
107
108
# File 'lib/xmpp4r/discovery/iq/discoinfo.rb', line 103

def initialize(category=nil, iname=nil, type=nil)
  super('identity')
  set_category(category)
  set_iname(iname)
  set_type(type)
end

Instance Method Details

#categoryObject

Get the identity's category or nil

result
String


113
114
115
# File 'lib/xmpp4r/discovery/iq/discoinfo.rb', line 113

def category
  attributes['category']
end

#category=(val) ⇒ Object

Set the identity's category

Service Discovery categories should be somewhat standardized by some registry, so clients may represent specific categories by specific icons… (see www.jabber.org/registrar/disco-categories.html)

val
String


125
126
127
# File 'lib/xmpp4r/discovery/iq/discoinfo.rb', line 125

def category=(val)
  attributes['category'] = val
end

#inameObject

Get the identity's name or nil

This has been renamed from <name/> to “iname” here to keep REXML::Element#name accessible

result
String


143
144
145
# File 'lib/xmpp4r/discovery/iq/discoinfo.rb', line 143

def iname
  attributes['name']
end

#iname=(val) ⇒ Object

Set the identity's name

val
String


150
151
152
# File 'lib/xmpp4r/discovery/iq/discoinfo.rb', line 150

def iname=(val)
  attributes['name'] = val
end

#set_category(val) ⇒ Object

Set the identity's category (chaining-friendly)

val
String


132
133
134
135
# File 'lib/xmpp4r/discovery/iq/discoinfo.rb', line 132

def set_category(val)
  self.category = val
  self
end

#set_iname(val) ⇒ Object

Set the identity's name (chaining-friendly)

val
String


157
158
159
160
# File 'lib/xmpp4r/discovery/iq/discoinfo.rb', line 157

def set_iname(val)
  self.iname = val
  self
end

#set_type(val) ⇒ Object

Set the identity's type (chaining-friendly)

val
String


180
181
182
183
# File 'lib/xmpp4r/discovery/iq/discoinfo.rb', line 180

def set_type(val)
  self.type = val
  self
end

#typeObject

Get the identity's type or nil

result
String


165
166
167
# File 'lib/xmpp4r/discovery/iq/discoinfo.rb', line 165

def type
  attributes['type']
end

#type=(val) ⇒ Object

Set the identity's type (see www.jabber.org/registrar/disco-categories.html)

val
String


173
174
175
# File 'lib/xmpp4r/discovery/iq/discoinfo.rb', line 173

def type=(val)
  attributes['type'] = val
end