Module: Kibosh::Response::Mixin
- Included in:
- Kibosh::Response
- Defined in:
- lib/kibosh/response.rb
Instance Attribute Summary collapse
-
#stream ⇒ Object
Returns the value of attribute stream.
Instance Method Summary collapse
- #body ⇒ Object
- #body=(body) ⇒ Object
- #headers ⇒ Object
- #rack ⇒ Object
- #status ⇒ Object
- #status=(status) ⇒ Object
- #xml ⇒ Object
Instance Attribute Details
#stream ⇒ Object
Returns the value of attribute stream.
6 7 8 |
# File 'lib/kibosh/response.rb', line 6 def stream @stream end |
Instance Method Details
#body ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/kibosh/response.rb', line 45 def body @body ||= begin document = Nokogiri::XML::Document.new body = document.create_element("body") body.attributes.merge! :xmlns => 'http://jabber.org/protocol/httpbind' # puts "new body #{body.object_id}" document.root = body end end |
#body=(body) ⇒ Object
40 41 42 43 |
# File 'lib/kibosh/response.rb', line 40 def body= body raise "hell" if @body @body = body end |
#headers ⇒ Object
36 37 38 |
# File 'lib/kibosh/response.rb', line 36 def headers { "Content-Type" => @session ? @session.content : "text/xml; charset=utf-8" } end |
#rack ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/kibosh/response.rb', line 8 def rack if deferred raise "hell" if defer_fired || deliver_fired defer_fired = true v = [-1, {}, []].freeze puts "[ defer" else raise "hell" if deliver_fired if @body["type"] == "terminate" @callback.receiver.instance_eval do @can_persist = false end end deliver_fired = true v = [ status || 200, headers, xml ] puts "[ #{v[2]}" end v end |
#status ⇒ Object
28 29 30 |
# File 'lib/kibosh/response.rb', line 28 def status @session && @session.ver && 200 || @status end |
#status=(status) ⇒ Object
32 33 34 |
# File 'lib/kibosh/response.rb', line 32 def status= status @status = status end |
#xml ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/kibosh/response.rb', line 56 def xml # puts "sending resp #{self.object_id} body #{@body.object_id}" v = @body.document.to_xml :save_with => 0 # @body["sent"] = "true" # puts "sent #{@body}" v end |