Class: Blather::Stream::Resource

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

Overview

:nodoc:

Constant Summary collapse

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

Instance Method Summary collapse

Methods inherited from Features

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

Constructor Details

#initialize(stream, succeed, fail) ⇒ Resource

Returns a new instance of Resource.



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

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

Instance Method Details

#receive_data(stanza) ⇒ Object



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

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