Class: AgentXmpp::Xmpp::Stanza
- Inherits:
-
Element
- Object
- REXML::Element
- Element
- AgentXmpp::Xmpp::Stanza
- Defined in:
- lib/agent_xmpp/xmpp/stanza.rb
Overview
Class Method Summary (collapse)
-
+ (Object) answer(stanza, import = true)
.......................................................................................................
Instance Method Summary (collapse)
-
- (Object) answer(import = true)
.......................................................................................................
-
- (Object) error
.......................................................................................................
-
- (Object) from
.......................................................................................................
-
- (Object) from=(v)
.......................................................................................................
-
- (Object) id
.......................................................................................................
-
- (Object) id=(v)
.......................................................................................................
-
- (Object) normalize
.......................................................................................................
-
- (Object) to
.......................................................................................................
-
- (Object) to=(v)
.......................................................................................................
-
- (Object) type
.......................................................................................................
-
- (Object) type=(t)
.......................................................................................................
Methods inherited from Element
#<<, class_for_name_xmlns, #clone, import, #initialize, name_xmlns, name_xmlns_for_class, #parent=, #set_xml_lang, #typed_add, #xml_lang, #xml_lang=, xmpp_attribute, xmpp_child
Methods inherited from REXML::Element
#delete_elements, #first_element, #first_element_text, import, #import, #replace_element_text, #typed_add
Constructor Details
This class inherits a constructor from AgentXmpp::Xmpp::Element
Class Method Details
+ (Object) answer(stanza, import = true)
.......................................................................................................
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 34 def Stanza.answer(stanza, import=true) x = stanza.class.new if import x.import(stanza) end x.from = stanza.to x.to = stanza.from x.id = stanza.id x end |
Instance Method Details
- (Object) answer(import = true)
.......................................................................................................
51 52 53 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 51 def answer(import=true) Stanza.answer(self, import) end |
- (Object) error
.......................................................................................................
46 47 48 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 46 def error first_element('error') end |
- (Object) from
.......................................................................................................
70 71 72 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 70 def from (a = attribute('from')).nil? ? a : Jid.new(a.value) end |
- (Object) from=(v)
.......................................................................................................
75 76 77 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 75 def from=(v) add_attribute('from', v ? v.to_s : nil) end |
- (Object) id
.......................................................................................................
80 81 82 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 80 def id (a = attribute('id')).nil? ? a : a.value end |
- (Object) id=(v)
.......................................................................................................
85 86 87 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 85 def id=(v) add_attribute('id', v.to_s) end |
- (Object) normalize
.......................................................................................................
56 57 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 56 def normalize end |
- (Object) to
.......................................................................................................
60 61 62 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 60 def to (a = attribute('to')).nil? ? a : Jid.new(a.value) end |
- (Object) to=(v)
.......................................................................................................
65 66 67 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 65 def to=(v) add_attribute('to', v ? v.to_s : nil) end |
- (Object) type
.......................................................................................................
90 91 92 93 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 90 def type stanza_type = attributes['type'] stanza_type.nil? ? nil : stanza_type.to_sym end |
- (Object) type=(t)
.......................................................................................................
96 97 98 |
# File 'lib/agent_xmpp/xmpp/stanza.rb', line 96 def type=(t) attributes['type'] = t.to_s end |