Class: Jabber::Discovery::Item

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

Overview

Service Discovery item to add() to IqQueryDiscoItems

Please note that JEP 0030 requires the jid 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(jid = nil, iname = nil, node = nil) ⇒ Item

Initialize a new Service Discovery <item/> to be added to IqQueryDiscoItems

jid
JID
iname
String

Item name

node
String

Service Discovery node (not JID#node)


84
85
86
87
88
89
# File 'lib/xmpp4r/discovery/iq/discoitems.rb', line 84

def initialize(jid=nil, iname=nil, node=nil)
  super('item')
  set_jid(jid)
  set_iname(iname)
  set_node(node)
end

Instance Method Details

#inameObject

Get the item's name or nil

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

result
String

119
120
121
# File 'lib/xmpp4r/discovery/iq/discoitems.rb', line 119

def iname
  attributes['name']
end

#iname=(val) ⇒ Object

Set the item's name

val
String

126
127
128
# File 'lib/xmpp4r/discovery/iq/discoitems.rb', line 126

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

#jidObject

Get the item's jid or nil

result
String

94
95
96
# File 'lib/xmpp4r/discovery/iq/discoitems.rb', line 94

def jid
  JID::new(attributes['jid'])
end

#jid=(val) ⇒ Object

Set the item's jid

val
JID

101
102
103
# File 'lib/xmpp4r/discovery/iq/discoitems.rb', line 101

def jid=(val)
  attributes['jid'] = val.to_s
end

#nodeObject

Get the item's Service Discovery node or nil

result
String

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

def node
  attributes['node']
end

#node=(val) ⇒ Object

Set the item's Service Discovery node

val
String

148
149
150
# File 'lib/xmpp4r/discovery/iq/discoitems.rb', line 148

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

#set_iname(val) ⇒ Object

Set the item's name (chaining-friendly)

val
String

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

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

#set_jid(val) ⇒ Object

Set the item's jid (chaining-friendly)

val
JID

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

def set_jid(val)
  self.jid = val
  self
end

#set_node(val) ⇒ Object

Set the item's Service Discovery node (chaining-friendly)

val
String

155
156
157
158
# File 'lib/xmpp4r/discovery/iq/discoitems.rb', line 155

def set_node(val)
  self.node = val
  self
end