Exception: Vines::SaslError

Inherits:
XmppError
  • Object
show all
Defined in:
lib/vines/error.rb

Constant Summary collapse

NAMESPACE =
'urn:ietf:params:xml:ns:xmpp-sasl'.freeze

Instance Method Summary collapse

Methods inherited from XmppError

#element_name

Constructor Details

#initialize(text = nil) ⇒ SaslError

Returns a new instance of SaslError.



18
19
20
# File 'lib/vines/error.rb', line 18

def initialize(text=nil)
  @text = text
end

Instance Method Details

#to_xmlObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/vines/error.rb', line 22

def to_xml
  doc = Document.new
  doc.create_element('failure') do |node|
    node.add_namespace(nil, NAMESPACE)
    node << doc.create_element(element_name)
    if @text
      node << doc.create_element('text') do |text|
        text['xml:lang'] = 'en'
        text.content = @text
      end
    end
  end.to_xml(:indent => 0).gsub(/\n/, '')
end