Class: Blather::Stream::Resource

Inherits:
Features
  • Object
show all
Defined in:
lib/blather/stream/features/resource.rb

Constant Summary

BIND_NS =
'urn:ietf:params:xml:ns:xmpp-bind'.freeze

Instance Method Summary collapse

Methods inherited from Features

#fail!, #feature?, from_namespace, #next!, register, #succeed!

Constructor Details

#initialize(stream, succeed, fail) ⇒ Resource



9
10
11
12
# File 'lib/blather/stream/features/resource.rb', line 9

def initialize(stream, succeed, fail)
  super
  @jid = stream.jid
end

Instance Method Details

#receive_data(stanza) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/blather/stream/features/resource.rb', line 14

def receive_data(stanza)
  @node = stanza
  case stanza.element_name
  when 'bind' then  bind
  when 'iq'   then  result
  else              fail!(UnknownResponse.new(@node))
  end
end