class TaaS::OutputParser

Public Class Methods

parse_server_output(response_body) click to toggle source
# File lib/helper/output_parser.rb, line 8
def self.parse_server_output(response_body)
  return nil unless valid_server_response?(response_body)
  body = response_body.scan(/<Taas-Output>(.*)<\/TaaS-Output>/m).first.first
  response_json = response_body.scan(/<TaaS-Json>(.*)<\/TaaS-Json>/m).first.first
  response_hash = JSON.parse(response_json) rescue nil
  return nil if response_hash.nil?
  return response_hash,body
end
parse_taas_output(output) click to toggle source
# File lib/helper/output_parser.rb, line 4
def self.parse_taas_output(output)
  output.scan(/<TaaS Response Start>(.*)<TaaS Response Complete>/m).first.first rescue nil
end
valid_server_response?(response) click to toggle source
# File lib/helper/output_parser.rb, line 17
def self.valid_server_response?(response)
  !(response.scan(/<Taas-Output>(.*)<\/TaaS-Output>/m).empty? || response.scan(/<TaaS-Json>(.*)<\/TaaS-Json>/m).empty?)
end