Class: Rack::AMF::Response
- Inherits:
-
Object
- Object
- Rack::AMF::Response
- Defined in:
- lib/rack/amf/response.rb
Instance Attribute Summary collapse
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
Instance Method Summary collapse
-
#each_method_call(&block) ⇒ Object
Builds response, iterating over each method call and using the return value as the method call’s return value.
-
#initialize(request) ⇒ Response
constructor
A new instance of Response.
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
3 4 5 |
# File 'lib/rack/amf/response.rb', line 3 def raw_response @raw_response end |
Instance Method Details
#each_method_call(&block) ⇒ Object
Builds response, iterating over each method call and using the return value as the method call’s return value
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rack/amf/response.rb', line 12 def each_method_call &block @request..each do |m| target_uri = m.response_uri rd = m.data if rd.is_a?(::AMF::Values::CommandMessage) if rd.operation == ::AMF::Values::CommandMessage::CLIENT_PING_OPERATION data = ::AMF::Values::AcknowledgeMessage.new(rd) else data == ::AMF::Values::ErrorMessage.new(Exception.new("CommandMessage #{rd.operation} not implemented"), rd) end elsif rd.is_a?(::AMF::Values::RemotingMessage) am = ::AMF::Values::AcknowledgeMessage.new(rd) body = dispatch_call(rd.source+'.'+rd.operation, rd.body, rd, block) if body.is_a?(::AMF::Values::ErrorMessage) data = body else am.body = body data = am end else data = dispatch_call(m.target_uri, rd, m, block) end target_uri += data.is_a?(::AMF::Values::ErrorMessage) ? '/onStatus' : '/onResult' @raw_response. << ::AMF::Message.new(target_uri, '', data) end end |
#to_s ⇒ Object
41 42 43 |
# File 'lib/rack/amf/response.rb', line 41 def to_s raw_response.serialize end |