Class: AnalyticsOps::Reports::Result
- Inherits:
-
Object
- Object
- AnalyticsOps::Reports::Result
- Defined in:
- lib/analytics_ops/reports/result.rb,
sig/analytics_ops.rbs
Overview
Immutable normalized Data API response.
Constant Summary collapse
- MAX_ROWS =
Definition::MAX_STANDARD_LIMIT
- MAX_CELL_BYTES =
1_048_576
Instance Attribute Summary collapse
-
#dimension_headers ⇒ Array[String]
readonly
Returns the value of attribute dimension_headers.
-
#headers ⇒ Array[String]
readonly
Returns the value of attribute headers.
-
#kind ⇒ String
readonly
Returns the value of attribute kind.
-
#metadata ⇒ record
readonly
Returns the value of attribute metadata.
-
#metric_headers ⇒ Array[String]
readonly
Returns the value of attribute metric_headers.
-
#name ⇒ String
readonly
Returns the value of attribute name.
-
#row_count ⇒ Integer
readonly
Returns the value of attribute row_count.
-
#rows ⇒ Array[record]
readonly
Returns the value of attribute rows.
Instance Method Summary collapse
-
#initialize(name:, kind:, dimension_headers:, metric_headers:, rows:, row_count:, metadata:) ⇒ Result
constructor
A new instance of Result.
- #to_h ⇒ record
Constructor Details
#initialize(name:, kind:, dimension_headers:, metric_headers:, rows:, row_count:, metadata:) ⇒ Result
Returns a new instance of Result.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/analytics_ops/reports/result.rb', line 12 def initialize(name:, kind:, dimension_headers:, metric_headers:, rows:, row_count:, metadata:) @name = string(name, "name") @kind = kind_value(kind) @dimension_headers = normalize_headers(dimension_headers, "dimension_headers") @metric_headers = normalize_headers(metric_headers, "metric_headers") @headers = Canonical.immutable(@dimension_headers + @metric_headers) validate_header_uniqueness! @rows = normalized_rows(rows) @row_count = count(row_count) @metadata = () freeze end |
Instance Attribute Details
#dimension_headers ⇒ Array[String] (readonly)
Returns the value of attribute dimension_headers.
10 11 12 |
# File 'lib/analytics_ops/reports/result.rb', line 10 def dimension_headers @dimension_headers end |
#headers ⇒ Array[String] (readonly)
Returns the value of attribute headers.
10 11 12 |
# File 'lib/analytics_ops/reports/result.rb', line 10 def headers @headers end |
#kind ⇒ String (readonly)
Returns the value of attribute kind.
10 11 12 |
# File 'lib/analytics_ops/reports/result.rb', line 10 def kind @kind end |
#metadata ⇒ record (readonly)
Returns the value of attribute metadata.
10 11 12 |
# File 'lib/analytics_ops/reports/result.rb', line 10 def @metadata end |
#metric_headers ⇒ Array[String] (readonly)
Returns the value of attribute metric_headers.
10 11 12 |
# File 'lib/analytics_ops/reports/result.rb', line 10 def metric_headers @metric_headers end |
#name ⇒ String (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/analytics_ops/reports/result.rb', line 10 def name @name end |
#row_count ⇒ Integer (readonly)
Returns the value of attribute row_count.
10 11 12 |
# File 'lib/analytics_ops/reports/result.rb', line 10 def row_count @row_count end |
#rows ⇒ Array[record] (readonly)
Returns the value of attribute rows.
10 11 12 |
# File 'lib/analytics_ops/reports/result.rb', line 10 def rows @rows end |
Instance Method Details
#to_h ⇒ record
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/analytics_ops/reports/result.rb', line 25 def to_h { "name" => name, "kind" => kind, "dimension_headers" => dimension_headers, "metric_headers" => metric_headers, "rows" => rows, "row_count" => row_count, "metadata" => } end |