Class: Jabber::Discovery::Item

Inherits:
XMPPElement 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 XMPPElement

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

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)



61
62
63
64
65
66
# File 'lib/xmpp4r/discovery/iq/discoitems.rb', line 61

def initialize(jid=nil, iname=nil, node=nil)
  super()
  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


96
97
98
# File 'lib/xmpp4r/discovery/iq/discoitems.rb', line 96

def iname
  attributes['name']
end

#iname=(val) ⇒ Object

Set the item’s name

val
String


103
104
105
# File 'lib/xmpp4r/discovery/iq/discoitems.rb', line 103

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

#jidObject

Get the item’s jid or nil

result
String


71
72
73
# File 'lib/xmpp4r/discovery/iq/discoitems.rb', line 71

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

#jid=(val) ⇒ Object

Set the item’s jid

val
JID


78
79
80
# File 'lib/xmpp4r/discovery/iq/discoitems.rb', line 78

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

#nodeObject

Get the item’s Service Discovery node or nil

result
String


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

def node
  attributes['node']
end

#node=(val) ⇒ Object

Set the item’s Service Discovery node

val
String


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

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

#set_iname(val) ⇒ Object

Set the item’s name (chaining-friendly)

val
String


110
111
112
113
# File 'lib/xmpp4r/discovery/iq/discoitems.rb', line 110

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

#set_jid(val) ⇒ Object

Set the item’s jid (chaining-friendly)

val
JID


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

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

#set_node(val) ⇒ Object

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

val
String


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

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