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=, #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(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)



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

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


105
106
107
# File 'lib/xmpp4r/discovery/iq/discoitems.rb', line 105

def iname
  attributes['name']
end

#iname=(val) ⇒ Object

Set the item’s name

val
String


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

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

#jidObject

Get the item’s jid or nil

result
String


80
81
82
# File 'lib/xmpp4r/discovery/iq/discoitems.rb', line 80

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

#jid=(val) ⇒ Object

Set the item’s jid

val
JID


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

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

#nodeObject

Get the item’s Service Discovery node or nil

result
String


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

def node
  attributes['node']
end

#node=(val) ⇒ Object

Set the item’s Service Discovery node

val
String


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

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

#set_iname(val) ⇒ Object

Set the item’s name (chaining-friendly)

val
String


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

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

#set_jid(val) ⇒ Object

Set the item’s jid (chaining-friendly)

val
JID


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

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

#set_node(val) ⇒ Object

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

val
String


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

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