module ResponseConverter TAG_CONVERTER = lambda do |tag| tag.snakecase.gsub(/@/, '').gsub(/unified_/, '').gsub(/current_/, '').to_sym end def convert_value(input) if input == 'True' || input == 'true' || input == 'TRUE' return true elsif input == 'False' || input == 'false' || input == 'FALSE' return false else begin return Integer(input) rescue StandardError => e begin return Float(input) rescue StandardError => e end end end input end def convert_response(input) if input.is_a?(Hash) input.each do |key, value| if value.is_a?(Hash) || value.is_a?(Array) convert_response(value) else input[key] = convert_value(value) end end elsif input.is_a?(Array) input.each_with_index do |value, index| if value.is_a?(Hash) || value.is_a?(Array) convert_response(value) else input[index] = convert_value(value) end end else input end end end