Module: Viewpoint::EWS::SOAP::Parser
- Included in:
- EwsParser
- Defined in:
- lib/soap/handsoap/parser.rb
Instance Method Summary collapse
- #initialize(response) ⇒ Object
-
#parse(opts) ⇒ Object
This is the main parser method.
Instance Method Details
#initialize(response) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/soap/handsoap/parser.rb', line 24 def initialize(response) # Unwrap SOAP Envelope @response = response @response_type = (response/"//#{NS_SOAP}:Body/*").first.node_name rmsg = (response/'//*[@ResponseClass]').first @response_message = EwsSoapResponse.new(rmsg['ResponseClass'], (rmsg/'m:ResponseCode/text()').first.to_s, (rmsg/'m:MessageText/text()').first.to_s) @response_message.set_soap_resp(response) end |
#parse(opts) ⇒ Object
TODO:
Decide on an appropriate response if a method does not exist.
This is the main parser method. It takes the response type and tries to call a Ruby method of the same name.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/soap/handsoap/parser.rb', line 40 def parse(opts) resp_method = @response_type.ruby_case if(respond_to?(resp_method)) puts "Method Exists: #{resp_method}" if $DEBUG method(resp_method).call(opts) else puts "No Method: #{resp_method}" if $DEBUG end @response_message end |