class Blather::Stanza::Iq::S5b::StreamHost

StreamHost Stanza

Public Class Methods

new(jid, host = nil, port = nil) click to toggle source

Create a new S5b::StreamHost

@overload new(node)

Create a new StreamHost by inheriting an existing node
@param [XML::Node] node an XML::Node to inherit from

@overload new(opts)

Create a new StreamHost through a hash of options
@param [Hash] opts a hash options
@option opts [Blather::JID, String] :jid the JID of the StreamHost
@option opts [#to_s] :host the host the StreamHost
@option opts [#to_s] :port the post of the StreamHost

@overload new(jid, host = nil, port = nil)

Create a new StreamHost
@param [Blather::JID, String] jid the JID of the StreamHost
@param [#to_s] host the host the StreamHost
@param [#to_s] port the post of the StreamHost
Calls superclass method
# 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

Public Instance Methods

host() click to toggle source

Get the host address of the streamhost

@return [String, nil]

# File lib/blather/stanza/iq/s5b.rb, line 127
def host
  read_attr :host
end
host=(h) click to toggle source

Set the host address of the streamhost

@param [String, nil]

# File lib/blather/stanza/iq/s5b.rb, line 134
def host=(h)
  write_attr :host, h
end
jid() click to toggle source

Get the jid of the streamhost

@return [Blather::JID, nil]

# 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) click to toggle source

Set the jid of the streamhost

@param [Blather::JID, String, nil]

# File lib/blather/stanza/iq/s5b.rb, line 120
def jid=(j)
  write_attr :jid, (j ? j.to_s : nil)
end
port() click to toggle source

Get the port of the streamhost

@return [Fixnum, nil]

# 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) click to toggle source

Set the port of the streamhost

@param [String, Fixnum, nil]

# File lib/blather/stanza/iq/s5b.rb, line 152
def port=(p)
  write_attr :port, p
end