Class: Jabber::Discovery::Identity

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

Overview

Service Discovery identity to add() to IqQueryDiscoInfo

Please note that XEP 0030 requires both category and type to occur, for a reference see: www.xmpp.org/registrar/disco-categories.html

Instance Method Summary collapse

Methods inherited from XMPPElement

class_for_name_xmlns, #clone, force_xmlns, force_xmlns?, import, name_xmlns, name_xmlns_for_class, #parent=, #set_xml_lang, #typed_add, #xml_lang, #xml_lang=

Methods inherited from REXML::Element

#==, #delete_elements, #each_elements, #first_element, #first_element_content, #first_element_text, #import, import, #replace_element_content, #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



87
88
89
90
91
92
# File 'lib/xmpp4r/discovery/iq/discoinfo.rb', line 87

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

Instance Method Details

#categoryObject

Get the identity’s category or nil

result
String


97
98
99
# File 'lib/xmpp4r/discovery/iq/discoinfo.rb', line 97

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


109
110
111
# File 'lib/xmpp4r/discovery/iq/discoinfo.rb', line 109

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


127
128
129
# File 'lib/xmpp4r/discovery/iq/discoinfo.rb', line 127

def iname
  attributes['name']
end

#iname=(val) ⇒ Object

Set the identity’s name

val
String


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

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

#set_category(val) ⇒ Object

Set the identity’s category (chaining-friendly)

val
String


116
117
118
119
# File 'lib/xmpp4r/discovery/iq/discoinfo.rb', line 116

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

#set_iname(val) ⇒ Object

Set the identity’s name (chaining-friendly)

val
String


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

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

#set_type(val) ⇒ Object

Set the identity’s type (chaining-friendly)

val
String


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

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

#typeObject

Get the identity’s type or nil

result
String


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

def type
  attributes['type']
end

#type=(val) ⇒ Object

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

val
String


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

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