Sha256: 513ab6e2a59ae31433d5726bf985df2bc5f2e4873cddc8e828067b728bfa20ef
Contents?: true
Size: 926 Bytes
Versions: 4
Compression:
Stored size: 926 Bytes
Contents
# frozen_string_literal: true require 'json' require 'date' module GoogleAnalyticsV4Api class ReportResponse attr_accessor :body, :raw_dimension_headers, :raw_metric_headers, :rows, :row_count, :metadata, :kind def initialize(body) @body = JSON.parse body @raw_dimension_headers = @body["dimensionHeaders"] || [] @raw_metric_headers = @body["metricHeaders"] || [] @rows = @body["rows"] || [] @row_cont = @body["rowCount"] || 0 @metadata = @body["metadata"] @kind = @body["kind"] end def dimension_headers @dimension_headers ||= @raw_dimension_headers.map { |header| header["name"] } end def metric_headers @metric_headers ||= @raw_metric_headers.map { |header| header["name"] } end def parsed_rows @rows.map do |row| ReportResponseRow.new(row, @raw_dimension_headers, @raw_metric_headers) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems