Class: Blather::Stanza::Iq::S5b::StreamHost
- Inherits:
-
XMPPNode
- Object
- Niceogiri::XML::Node
- XMPPNode
- Blather::Stanza::Iq::S5b::StreamHost
- Defined in:
- lib/blather/stanza/iq/s5b.rb
Overview
StreamHost Stanza
Constant Summary
Constants inherited from XMPPNode
Class Method Summary collapse
-
.new(jid, host = nil, port = nil) ⇒ Object
Create a new S5b::StreamHost.
Instance Method Summary collapse
-
#host ⇒ String?
Get the host address of the streamhost.
-
#host=(h) ⇒ Object
Set the host address of the streamhost.
-
#jid ⇒ Blather::JID?
Get the jid of the streamhost.
-
#jid=(j) ⇒ Object
Set the jid of the streamhost.
-
#port ⇒ Fixnum?
Get the port of the streamhost.
-
#port=(p) ⇒ Object
Set the port of the streamhost.
Methods inherited from XMPPNode
class_from_registration, #decorate, decorator_modules, import, parse, register, #to_stanza
Class Method Details
.new(node) ⇒ Object .new(opts) ⇒ Object .new(jid, host = nil, port = nil) ⇒ Object
Create a new S5b::StreamHost
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/blather/stanza/iq/s5b.rb', line 88 def self.new(jid, host = nil, port = nil) new_node = super 'streamhost' case jid when Nokogiri::XML::Node new_node.inherit jid when Hash new_node.jid = jid[:jid] new_node.host = jid[:host] new_node.port = jid[:port] else new_node.jid = jid new_node.host = host new_node.port = port end new_node end |
Instance Method Details
#host ⇒ String?
Get the host address of the streamhost
127 128 129 |
# File 'lib/blather/stanza/iq/s5b.rb', line 127 def host read_attr :host end |
#host=(h) ⇒ Object
Set the host address of the streamhost
134 135 136 |
# File 'lib/blather/stanza/iq/s5b.rb', line 134 def host=(h) write_attr :host, h end |
#jid ⇒ Blather::JID?
Get the jid of the streamhost
109 110 111 112 113 114 115 |
# File 'lib/blather/stanza/iq/s5b.rb', line 109 def jid if j = read_attr(:jid) JID.new(j) else nil end end |
#jid=(j) ⇒ Object
Set the jid of the streamhost
120 121 122 |
# File 'lib/blather/stanza/iq/s5b.rb', line 120 def jid=(j) write_attr :jid, (j ? j.to_s : nil) end |
#port ⇒ Fixnum?
Get the port of the streamhost
141 142 143 144 145 146 147 |
# File 'lib/blather/stanza/iq/s5b.rb', line 141 def port if p = read_attr(:port) p.to_i else nil end end |
#port=(p) ⇒ Object
Set the port of the streamhost
152 153 154 |
# File 'lib/blather/stanza/iq/s5b.rb', line 152 def port=(p) write_attr :port, p end |