Class: Blather::Stanza::Iq::S5b::StreamHostUsed

Inherits:
XMPPNode
  • Object
show all
Defined in:
lib/blather/stanza/iq/s5b.rb

Overview

Stream host used stanza

Constant Summary

Constants inherited from XMPPNode

XMPPNode::BASE_NAMES

Class Method Summary collapse

Instance Method Summary collapse

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) ⇒ Object

Create a new S5b::StreamHostUsed

Overloads:

  • .new(node) ⇒ Object

    Create a new StreamHostUsed by inheriting an existing node

    Parameters:

    • node (XML::Node)

      an XML::Node to inherit from

  • .new(opts) ⇒ Object

    Create a new StreamHostUsed through a hash of options

    Parameters:

    • opts (Hash)

      a hash options

    Options Hash (opts):

    • :jid (Blather::JID, String)

      the JID of the StreamHostUsed

  • .new(jid) ⇒ Object

    Create a new StreamHostUsed

    Parameters:

    • jid (Blather::JID, String)

      the JID of the StreamHostUsed



173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/blather/stanza/iq/s5b.rb', line 173

def self.new(jid)
  new_node = super 'streamhost-used'

  case jid
  when Nokogiri::XML::Node
    new_node.inherit jid
  when Hash
    new_node.jid = jid[:jid]
  else
    new_node.jid = jid
  end
  new_node
end

Instance Method Details

#jidBlather::JID?

Get the jid of the used streamhost

Returns:



190
191
192
193
194
195
196
# File 'lib/blather/stanza/iq/s5b.rb', line 190

def jid
  if j = read_attr(:jid)
    JID.new(j)
  else
    nil
  end
end

#jid=(j) ⇒ Object

Set the jid of the used streamhost

Parameters:



201
202
203
# File 'lib/blather/stanza/iq/s5b.rb', line 201

def jid=(j)
  write_attr :jid, (j ? j.to_s : nil)
end