def convert_metric(i)
      case report.metric_type(i)
      when "INTEGER"
        # INTEGER  Integer metric.
        metrics[i].to_i
      when "FLOAT", "PERCENT"
        # FLOAT  Float metric.
        # PERCENT  Percentage metric.
        metrics[i].to_f
      when "CURRENCY"
        # CURRENCY  Currency metric.
        # TODO: Do this better.
        metrics[i].to_f
      when "TIME"
        # Google documentation claims to following:
        # TIME  Time metric in HH:MM:SS format.
        # It also says it's seconds, and that's what I see in real results.
        # So comment out the following:
        # (metrics[i][0..1].to_i +
        #   metrics[i][3..4].to_i * 60 +
        #   metrics[i][6..7].to_i * 24 * 60)
        # Simply make it a float.
        metrics[i].to_f
      else
        # METRIC_TYPE_UNSPECIFIED  Metric type is unspecified.
        metric[i]
      end
    end
def convert_metric(i)
      case report.metric_type(i)
      when "INTEGER"
        # INTEGER  Integer metric.
        metrics[i].to_i
      when "FLOAT", "PERCENT"
        # FLOAT  Float metric.
        # PERCENT  Percentage metric.
        metrics[i].to_f
      when "CURRENCY"
        # CURRENCY  Currency metric.
        # TODO: Do this better.
        metrics[i].to_f
      when "TIME"
        # Google documentation claims to following:
        # TIME  Time metric in HH:MM:SS format.
        # It also says it's seconds, and that's what I see in real results.
        # So comment out the following:
        # (metrics[i][0..1].to_i +
        #   metrics[i][3..4].to_i * 60 +
        #   metrics[i][6..7].to_i * 24 * 60)
        # Simply make it a float.
        metrics[i].to_f
      else
        # METRIC_TYPE_UNSPECIFIED  Metric type is unspecified.
        metric[i]
      end
    end
Convert metric to the right type.