From 36991dfe3f5c1b131d283a081739a23a0883c668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serge=20H=C3=A4nni?= Date: Thu, 11 Jun 2026 17:03:23 +0200 Subject: [PATCH] Align reporting aggregation models with operator API Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../operator/reporting/report_aggregation.rb | 4 + .../reporting/report_aggregation_dimension.rb | 2 +- .../reporting/report_aggregation_filter.rb | 2 +- .../reporting/report_aggregation_measure.rb | 12 +-- .../report_aggregation_measure_series.rb | 24 ++++-- .../report_aggregation_measure_total.rb | 20 ++++- .../reporting/report_aggregation_series.rb | 4 + .../reporting/report_aggregation_totals.rb | 4 + .../report_aggregation_dimension_spec.rb | 6 +- .../report_aggregation_filter_spec.rb | 6 +- .../report_aggregation_measure_series_spec.rb | 35 +++++---- .../report_aggregation_measure_spec.rb | 28 +++---- .../report_aggregation_measure_total_spec.rb | 28 +++++-- .../report_aggregation_series_spec.rb | 48 +++++++----- .../reporting/report_aggregation_spec.rb | 33 ++++---- .../report_aggregation_totals_spec.rb | 23 ++++-- spec/ioki/operator_api_spec.rb | 77 +++++++++++-------- 17 files changed, 224 insertions(+), 132 deletions(-) diff --git a/lib/ioki/model/operator/reporting/report_aggregation.rb b/lib/ioki/model/operator/reporting/report_aggregation.rb index ccb9eac4..669dde32 100644 --- a/lib/ioki/model/operator/reporting/report_aggregation.rb +++ b/lib/ioki/model/operator/reporting/report_aggregation.rb @@ -13,6 +13,10 @@ class ReportAggregation < Base on: :read, type: :string + attribute :localized_name, + on: :read, + type: :string + attribute :visualization, on: :read, type: :string diff --git a/lib/ioki/model/operator/reporting/report_aggregation_dimension.rb b/lib/ioki/model/operator/reporting/report_aggregation_dimension.rb index 8c03dab9..05660ac8 100644 --- a/lib/ioki/model/operator/reporting/report_aggregation_dimension.rb +++ b/lib/ioki/model/operator/reporting/report_aggregation_dimension.rb @@ -13,7 +13,7 @@ class ReportAggregationDimension < Base on: :read, type: :string - attribute :localized_label, + attribute :localized_name, on: :read, type: :string diff --git a/lib/ioki/model/operator/reporting/report_aggregation_filter.rb b/lib/ioki/model/operator/reporting/report_aggregation_filter.rb index 1d380b6c..9f4af0c9 100644 --- a/lib/ioki/model/operator/reporting/report_aggregation_filter.rb +++ b/lib/ioki/model/operator/reporting/report_aggregation_filter.rb @@ -13,7 +13,7 @@ class ReportAggregationFilter < Base on: :read, type: :string - attribute :localized_label, + attribute :localized_name, on: :read, type: :string diff --git a/lib/ioki/model/operator/reporting/report_aggregation_measure.rb b/lib/ioki/model/operator/reporting/report_aggregation_measure.rb index 636e1d65..939680a7 100644 --- a/lib/ioki/model/operator/reporting/report_aggregation_measure.rb +++ b/lib/ioki/model/operator/reporting/report_aggregation_measure.rb @@ -13,6 +13,10 @@ class ReportAggregationMeasure < Base on: :read, type: :string + attribute :localized_name, + on: :read, + type: :string + attribute :function, on: :read, type: :string @@ -25,15 +29,11 @@ class ReportAggregationMeasure < Base on: :read, type: :string - attribute :localized_label, - on: :read, - type: :string - - attribute :localized_type, + attribute :measure_type, on: :read, type: :string - attribute :value_type, + attribute :localized_measure_type, on: :read, type: :string end diff --git a/lib/ioki/model/operator/reporting/report_aggregation_measure_series.rb b/lib/ioki/model/operator/reporting/report_aggregation_measure_series.rb index 6fb17da5..e1d8c6d6 100644 --- a/lib/ioki/model/operator/reporting/report_aggregation_measure_series.rb +++ b/lib/ioki/model/operator/reporting/report_aggregation_measure_series.rb @@ -9,21 +9,33 @@ class ReportAggregationMeasureSeries < Base on: :read, type: :string - attribute :key, + attribute :measure_name, on: :read, type: :string - attribute :localized_label, + attribute :localized_measure_name, on: :read, type: :string - attribute :points, + attribute :dimension_name, on: :read, - type: :array + type: :string + + attribute :localized_dimension_name, + on: :read, + type: :string + + attribute :dimension_value, + on: :read, + type: :string - attribute :trend, + attribute :localized_dimension_value, on: :read, - type: :float + type: :string + + attribute :points, + on: :read, + type: :array end end end diff --git a/lib/ioki/model/operator/reporting/report_aggregation_measure_total.rb b/lib/ioki/model/operator/reporting/report_aggregation_measure_total.rb index c6028136..86ba87d2 100644 --- a/lib/ioki/model/operator/reporting/report_aggregation_measure_total.rb +++ b/lib/ioki/model/operator/reporting/report_aggregation_measure_total.rb @@ -9,11 +9,27 @@ class ReportAggregationMeasureTotal < Base on: :read, type: :string - attribute :key, + attribute :measure_name, on: :read, type: :string - attribute :localized_label, + attribute :localized_measure_name, + on: :read, + type: :string + + attribute :dimension_name, + on: :read, + type: :string + + attribute :localized_dimension_name, + on: :read, + type: :string + + attribute :dimension_value, + on: :read, + type: :string + + attribute :localized_dimension_value, on: :read, type: :string diff --git a/lib/ioki/model/operator/reporting/report_aggregation_series.rb b/lib/ioki/model/operator/reporting/report_aggregation_series.rb index a38f70ab..0e8d0ccc 100644 --- a/lib/ioki/model/operator/reporting/report_aggregation_series.rb +++ b/lib/ioki/model/operator/reporting/report_aggregation_series.rb @@ -13,6 +13,10 @@ class ReportAggregationSeries < Base on: :read, type: :string + attribute :localized_aggregation_name, + on: :read, + type: :string + attribute :visualization, on: :read, type: :string diff --git a/lib/ioki/model/operator/reporting/report_aggregation_totals.rb b/lib/ioki/model/operator/reporting/report_aggregation_totals.rb index dc53cc2b..ea952ab3 100644 --- a/lib/ioki/model/operator/reporting/report_aggregation_totals.rb +++ b/lib/ioki/model/operator/reporting/report_aggregation_totals.rb @@ -13,6 +13,10 @@ class ReportAggregationTotals < Base on: :read, type: :string + attribute :localized_aggregation_name, + on: :read, + type: :string + attribute :measures, on: :read, type: :array, diff --git a/spec/ioki/model/operator/reporting/report_aggregation_dimension_spec.rb b/spec/ioki/model/operator/reporting/report_aggregation_dimension_spec.rb index 4370bcde..d741797b 100644 --- a/spec/ioki/model/operator/reporting/report_aggregation_dimension_spec.rb +++ b/spec/ioki/model/operator/reporting/report_aggregation_dimension_spec.rb @@ -7,7 +7,7 @@ { type: 'reporting/report_aggregation_dimension', name: 'booking_type', - localized_label: 'Booking type', + localized_name: 'Booking type', values: %w[prebooked adhoc], localized_values: ['Prebooked', 'Ad hoc'] } @@ -15,13 +15,13 @@ it { is_expected.to define_attribute(:type).as(:string) } it { is_expected.to define_attribute(:name).as(:string) } - it { is_expected.to define_attribute(:localized_label).as(:string) } + it { is_expected.to define_attribute(:localized_name).as(:string) } it { is_expected.to define_attribute(:values).as(:array) } it { is_expected.to define_attribute(:localized_values).as(:array) } it 'casts dimension metadata' do expect(dimension.name).to eq('booking_type') - expect(dimension.localized_label).to eq('Booking type') + expect(dimension.localized_name).to eq('Booking type') expect(dimension.values).to eq(%w[prebooked adhoc]) expect(dimension.localized_values).to eq(['Prebooked', 'Ad hoc']) end diff --git a/spec/ioki/model/operator/reporting/report_aggregation_filter_spec.rb b/spec/ioki/model/operator/reporting/report_aggregation_filter_spec.rb index 1ff2f2cb..40108f26 100644 --- a/spec/ioki/model/operator/reporting/report_aggregation_filter_spec.rb +++ b/spec/ioki/model/operator/reporting/report_aggregation_filter_spec.rb @@ -7,7 +7,7 @@ { type: 'reporting/report_aggregation_filter', name: 'operator_id', - localized_label: 'Operator', + localized_name: 'Operator', values: %w[op-1 op-2], localized_values: %w[Op-1 Op-2] } @@ -15,13 +15,13 @@ it { is_expected.to define_attribute(:type).as(:string) } it { is_expected.to define_attribute(:name).as(:string) } - it { is_expected.to define_attribute(:localized_label).as(:string) } + it { is_expected.to define_attribute(:localized_name).as(:string) } it { is_expected.to define_attribute(:values).as(:array) } it { is_expected.to define_attribute(:localized_values).as(:array) } it 'casts filter metadata' do expect(filter.name).to eq('operator_id') - expect(filter.localized_label).to eq('Operator') + expect(filter.localized_name).to eq('Operator') expect(filter.values).to eq(%w[op-1 op-2]) expect(filter.localized_values).to eq(%w[Op-1 Op-2]) end diff --git a/spec/ioki/model/operator/reporting/report_aggregation_measure_series_spec.rb b/spec/ioki/model/operator/reporting/report_aggregation_measure_series_spec.rb index 15cc1078..926bd9f4 100644 --- a/spec/ioki/model/operator/reporting/report_aggregation_measure_series_spec.rb +++ b/spec/ioki/model/operator/reporting/report_aggregation_measure_series_spec.rb @@ -5,28 +5,33 @@ let(:attributes) do { - type: 'reporting/report_aggregation_measure_series', - key: 'login_count', - localized_label: 'Logins', - points: [10.0, nil], - trend: 12.5 + type: 'reporting/report_aggregation_measure_series', + measure_name: 'login_count', + localized_measure_name: 'Logins', + dimension_name: 'uses_otp', + localized_dimension_name: 'Uses OTP', + dimension_value: 'true', + localized_dimension_value: 'Yes', + points: [10.0, nil] } end it { is_expected.to define_attribute(:type).as(:string) } - it { is_expected.to define_attribute(:key).as(:string) } - it { is_expected.to define_attribute(:localized_label).as(:string) } + it { is_expected.to define_attribute(:measure_name).as(:string) } + it { is_expected.to define_attribute(:localized_measure_name).as(:string) } + it { is_expected.to define_attribute(:dimension_name).as(:string) } + it { is_expected.to define_attribute(:localized_dimension_name).as(:string) } + it { is_expected.to define_attribute(:dimension_value).as(:string) } + it { is_expected.to define_attribute(:localized_dimension_value).as(:string) } it { is_expected.to define_attribute(:points).as(:array) } - it { is_expected.to define_attribute(:trend).as(:float) } it 'casts measure series metadata' do - expect(measure_series.key).to eq('login_count') - expect(measure_series.localized_label).to eq('Logins') + expect(measure_series.measure_name).to eq('login_count') + expect(measure_series.localized_measure_name).to eq('Logins') + expect(measure_series.dimension_name).to eq('uses_otp') + expect(measure_series.localized_dimension_name).to eq('Uses OTP') + expect(measure_series.dimension_value).to eq('true') + expect(measure_series.localized_dimension_value).to eq('Yes') expect(measure_series.points).to eq([10.0, nil]) - expect(measure_series.trend).to eq(12.5) - end - - it 'accepts nullable trends' do - expect(described_class.new(attributes.merge(trend: nil)).trend).to be_nil end end diff --git a/spec/ioki/model/operator/reporting/report_aggregation_measure_spec.rb b/spec/ioki/model/operator/reporting/report_aggregation_measure_spec.rb index 660844dd..8f7947c8 100644 --- a/spec/ioki/model/operator/reporting/report_aggregation_measure_spec.rb +++ b/spec/ioki/model/operator/reporting/report_aggregation_measure_spec.rb @@ -5,34 +5,34 @@ let(:attributes) do { - type: 'reporting/report_aggregation_measure', - name: 'login_count', - function: 'count_rows', - percentile: nil, - localized_function: 'Count', - localized_label: 'Logins', - localized_type: 'Count', - value_type: 'number' + type: 'reporting/report_aggregation_measure', + name: 'login_count', + localized_name: 'Logins', + function: 'count_rows', + percentile: nil, + localized_function: 'Count', + measure_type: 'number', + localized_measure_type: 'Count' } end it { is_expected.to define_attribute(:type).as(:string) } it { is_expected.to define_attribute(:name).as(:string) } + it { is_expected.to define_attribute(:localized_name).as(:string) } it { is_expected.to define_attribute(:function).as(:string) } it { is_expected.to define_attribute(:percentile).as(:float) } it { is_expected.to define_attribute(:localized_function).as(:string) } - it { is_expected.to define_attribute(:localized_label).as(:string) } - it { is_expected.to define_attribute(:localized_type).as(:string) } - it { is_expected.to define_attribute(:value_type).as(:string) } + it { is_expected.to define_attribute(:measure_type).as(:string) } + it { is_expected.to define_attribute(:localized_measure_type).as(:string) } it 'casts measure metadata' do expect(measure.name).to eq('login_count') + expect(measure.localized_name).to eq('Logins') expect(measure.function).to eq('count_rows') expect(measure.percentile).to be_nil expect(measure.localized_function).to eq('Count') - expect(measure.localized_label).to eq('Logins') - expect(measure.localized_type).to eq('Count') - expect(measure.value_type).to eq('number') + expect(measure.measure_type).to eq('number') + expect(measure.localized_measure_type).to eq('Count') end it 'casts percentile values for percentile measures' do diff --git a/spec/ioki/model/operator/reporting/report_aggregation_measure_total_spec.rb b/spec/ioki/model/operator/reporting/report_aggregation_measure_total_spec.rb index 9c508716..8e0ffa86 100644 --- a/spec/ioki/model/operator/reporting/report_aggregation_measure_total_spec.rb +++ b/spec/ioki/model/operator/reporting/report_aggregation_measure_total_spec.rb @@ -5,21 +5,33 @@ let(:attributes) do { - type: 'reporting/report_aggregation_measure_total', - key: 'login_count', - localized_label: 'Logins', - value: 30.0 + type: 'reporting/report_aggregation_measure_total', + measure_name: 'login_count', + localized_measure_name: 'Logins', + dimension_name: 'uses_otp', + localized_dimension_name: 'Uses OTP', + dimension_value: 'true', + localized_dimension_value: 'Yes', + value: 30.0 } end it { is_expected.to define_attribute(:type).as(:string) } - it { is_expected.to define_attribute(:key).as(:string) } - it { is_expected.to define_attribute(:localized_label).as(:string) } + it { is_expected.to define_attribute(:measure_name).as(:string) } + it { is_expected.to define_attribute(:localized_measure_name).as(:string) } + it { is_expected.to define_attribute(:dimension_name).as(:string) } + it { is_expected.to define_attribute(:localized_dimension_name).as(:string) } + it { is_expected.to define_attribute(:dimension_value).as(:string) } + it { is_expected.to define_attribute(:localized_dimension_value).as(:string) } it { is_expected.to define_attribute(:value).as(:float) } it 'casts total measure metadata' do - expect(measure_total.key).to eq('login_count') - expect(measure_total.localized_label).to eq('Logins') + expect(measure_total.measure_name).to eq('login_count') + expect(measure_total.localized_measure_name).to eq('Logins') + expect(measure_total.dimension_name).to eq('uses_otp') + expect(measure_total.localized_dimension_name).to eq('Uses OTP') + expect(measure_total.dimension_value).to eq('true') + expect(measure_total.localized_dimension_value).to eq('Yes') expect(measure_total.value).to eq(30.0) end diff --git a/spec/ioki/model/operator/reporting/report_aggregation_series_spec.rb b/spec/ioki/model/operator/reporting/report_aggregation_series_spec.rb index b174fd25..c67a930e 100644 --- a/spec/ioki/model/operator/reporting/report_aggregation_series_spec.rb +++ b/spec/ioki/model/operator/reporting/report_aggregation_series_spec.rb @@ -5,28 +5,33 @@ let(:attributes) do { - type: 'reporting/report_aggregation_series', - aggregation_name: 'admin_logins', - visualization: 'bar', - timezone_identifier: 'Europe/Berlin', - buckets: %w[2026-04-01 2026-04-02], - bucket: 'day', - measures: [ + type: 'reporting/report_aggregation_series', + aggregation_name: 'admin_logins', + localized_aggregation_name: 'Admin logins', + visualization: 'bar', + timezone_identifier: 'Europe/Berlin', + buckets: %w[2026-04-01 2026-04-02], + bucket: 'day', + measures: [ { - type: 'reporting/report_aggregation_measure_series', - key: 'login_count', - localized_label: 'Logins', - points: [10.0, 20.0], - trend: nil + type: 'reporting/report_aggregation_measure_series', + measure_name: 'login_count', + localized_measure_name: 'Logins', + dimension_name: nil, + localized_dimension_name: nil, + dimension_value: nil, + localized_dimension_value: nil, + points: [10.0, 20.0] } ], - partitions_considered: 2, - definition_versions: [1] + partitions_considered: 2, + definition_versions: [1] } end it { is_expected.to define_attribute(:type).as(:string) } it { is_expected.to define_attribute(:aggregation_name).as(:string) } + it { is_expected.to define_attribute(:localized_aggregation_name).as(:string) } it { is_expected.to define_attribute(:visualization).as(:string) } it { is_expected.to define_attribute(:timezone_identifier).as(:string) } it { is_expected.to define_attribute(:buckets).as(:array) } @@ -41,25 +46,32 @@ it 'casts measure series into reporting models' do expect(series.aggregation_name).to eq('admin_logins') + expect(series.localized_aggregation_name).to eq('Admin logins') expect(series.visualization).to eq('bar') expect(series.timezone_identifier).to eq('Europe/Berlin') expect(series.buckets).to eq(%w[2026-04-01 2026-04-02]) expect(series.bucket).to eq('day') expect(series.measures.first).to be_a(Ioki::Model::Operator::Reporting::ReportAggregationMeasureSeries) - expect(series.measures.first.localized_label).to eq('Logins') + expect(series.measures.first.localized_measure_name).to eq('Logins') expect(series.partitions_considered).to eq(2) expect(series.definition_versions).to eq([1]) end - it 'accepts nullable bucket metadata and measure trends' do + it 'accepts nullable bucket metadata and dimension metadata' do aggregation_series = described_class.new( attributes.merge( bucket: nil, - measures: [attributes[:measures].first.merge(trend: 12.5)] + measures: [attributes[:measures].first.merge( + dimension_name: 'uses_otp', + localized_dimension_name: 'Uses OTP', + dimension_value: 'true', + localized_dimension_value: 'Yes' + )] ) ) expect(aggregation_series.bucket).to be_nil - expect(aggregation_series.measures.first.trend).to eq(12.5) + expect(aggregation_series.measures.first.dimension_name).to eq('uses_otp') + expect(aggregation_series.measures.first.localized_dimension_value).to eq('Yes') end end diff --git a/spec/ioki/model/operator/reporting/report_aggregation_spec.rb b/spec/ioki/model/operator/reporting/report_aggregation_spec.rb index 03411a6f..4566bdd3 100644 --- a/spec/ioki/model/operator/reporting/report_aggregation_spec.rb +++ b/spec/ioki/model/operator/reporting/report_aggregation_spec.rb @@ -7,6 +7,7 @@ { type: 'reporting/report_aggregation', name: 'admin_logins', + localized_name: 'Admin logins', visualization: 'bar', localized_visualization: 'Bar chart', release_stage: 'stable', @@ -20,21 +21,21 @@ }, measures: [ { - type: 'reporting/report_aggregation_measure', - name: 'rides', - function: 'count_rows', - percentile: nil, - localized_function: 'Count', - localized_label: 'Rides', - localized_type: 'Count', - value_type: 'number' + type: 'reporting/report_aggregation_measure', + name: 'rides', + localized_name: 'Rides', + function: 'count_rows', + percentile: nil, + localized_function: 'Count', + measure_type: 'number', + localized_measure_type: 'Count' } ], dimensions: [ { type: 'reporting/report_aggregation_dimension', name: 'booking_type', - localized_label: 'Booking type', + localized_name: 'Booking type', values: ['prebooked', 'adhoc'], localized_values: ['Prebooked', 'Ad hoc'] } @@ -43,7 +44,7 @@ { type: 'reporting/report_aggregation_filter', name: 'operator_id', - localized_label: 'Operator', + localized_name: 'Operator', values: ['operator_1'], localized_values: ['Operator 1'] } @@ -53,6 +54,7 @@ it { is_expected.to define_attribute(:type).as(:string) } it { is_expected.to define_attribute(:name).as(:string) } + it { is_expected.to define_attribute(:localized_name).as(:string) } it { is_expected.to define_attribute(:visualization).as(:string) } it { is_expected.to define_attribute(:localized_visualization).as(:string) } it { is_expected.to define_attribute(:release_stage).as(:string) } @@ -63,6 +65,7 @@ it 'casts nested aggregation data into reporting models' do expect(report_aggregation.name).to eq('admin_logins') + expect(report_aggregation.localized_name).to eq('Admin logins') expect(report_aggregation.visualization).to eq('bar') expect(report_aggregation.localized_visualization).to eq('Bar chart') expect(report_aggregation.release_stage).to eq('stable') @@ -72,15 +75,15 @@ expect(report_aggregation.measures.first).to be_a( Ioki::Model::Operator::Reporting::ReportAggregationMeasure ) - expect(report_aggregation.measures.first.value_type).to eq('number') + expect(report_aggregation.measures.first.measure_type).to eq('number') expect(report_aggregation.measures.first.percentile).to be_nil - expect(report_aggregation.measures.first.localized_label).to eq('Rides') + expect(report_aggregation.measures.first.localized_name).to eq('Rides') expect(report_aggregation.dimensions.first).to be_a( Ioki::Model::Operator::Reporting::ReportAggregationDimension ) expect(report_aggregation.dimensions.first.localized_values).to eq(['Prebooked', 'Ad hoc']) expect(report_aggregation.filters.first).to be_a(Ioki::Model::Operator::Reporting::ReportAggregationFilter) - expect(report_aggregation.filters.first.localized_label).to eq('Operator') + expect(report_aggregation.filters.first.localized_name).to eq('Operator') end it 'accepts nullable bucket and known values metadata' do @@ -91,7 +94,7 @@ { type: 'reporting/report_aggregation_dimension', name: 'booking_type', - localized_label: 'Booking type', + localized_name: 'Booking type', values: nil, localized_values: nil } @@ -100,7 +103,7 @@ { type: 'reporting/report_aggregation_filter', name: 'operator_id', - localized_label: 'Operator', + localized_name: 'Operator', values: nil, localized_values: nil } diff --git a/spec/ioki/model/operator/reporting/report_aggregation_totals_spec.rb b/spec/ioki/model/operator/reporting/report_aggregation_totals_spec.rb index 94f70d47..193cf0a3 100644 --- a/spec/ioki/model/operator/reporting/report_aggregation_totals_spec.rb +++ b/spec/ioki/model/operator/reporting/report_aggregation_totals_spec.rb @@ -5,14 +5,19 @@ let(:attributes) do { - type: 'reporting/report_aggregation_totals', - aggregation_name: 'admin_logins', - measures: [ + type: 'reporting/report_aggregation_totals', + aggregation_name: 'admin_logins', + localized_aggregation_name: 'Admin logins', + measures: [ { - type: 'reporting/report_aggregation_measure_total', - key: 'login_count', - localized_label: 'Logins', - value: 30.0 + type: 'reporting/report_aggregation_measure_total', + measure_name: 'login_count', + localized_measure_name: 'Logins', + dimension_name: nil, + localized_dimension_name: nil, + dimension_value: nil, + localized_dimension_value: nil, + value: 30.0 } ] } @@ -20,12 +25,14 @@ it { is_expected.to define_attribute(:type).as(:string) } it { is_expected.to define_attribute(:aggregation_name).as(:string) } + it { is_expected.to define_attribute(:localized_aggregation_name).as(:string) } it { is_expected.to define_attribute(:measures).as(:array).with(class_name: 'ReportAggregationMeasureTotal') } it 'casts measure totals into reporting models' do expect(totals.aggregation_name).to eq('admin_logins') + expect(totals.localized_aggregation_name).to eq('Admin logins') expect(totals.measures.first).to be_a(Ioki::Model::Operator::Reporting::ReportAggregationMeasureTotal) - expect(totals.measures.first.localized_label).to eq('Logins') + expect(totals.measures.first.localized_measure_name).to eq('Logins') expect(totals.measures.first.value).to eq(30.0) end diff --git a/spec/ioki/operator_api_spec.rb b/spec/ioki/operator_api_spec.rb index 0a3e0385..a3cb2cbc 100644 --- a/spec/ioki/operator_api_spec.rb +++ b/spec/ioki/operator_api_spec.rb @@ -1885,6 +1885,7 @@ { type: 'reporting/report_aggregation', name: 'admin_logins', + localized_name: 'Admin logins', visualization: 'bar', localized_visualization: 'Bar chart', release_stage: 'stable', @@ -1910,14 +1911,14 @@ }, measures: [ { - type: 'reporting/report_aggregation_measure', - name: 'login_count', - function: 'count_rows', - percentile: nil, - localized_function: 'Count', - localized_label: 'Logins', - localized_type: 'Count', - value_type: 'number' + type: 'reporting/report_aggregation_measure', + name: 'login_count', + localized_name: 'Logins', + function: 'count_rows', + percentile: nil, + localized_function: 'Count', + measure_type: 'number', + localized_measure_type: 'Count' } ], dimensions: [], @@ -1938,10 +1939,11 @@ expect(aggregations).to all(be_a(Ioki::Model::Operator::Reporting::ReportAggregation)) expect(aggregations.first.name).to eq('admin_logins') + expect(aggregations.first.localized_name).to eq('Admin logins') expect(aggregations.first.localized_visualization).to eq('Bar chart') expect(aggregations.first.release_stage).to eq('stable') expect(aggregations.first.bucket.default_preset).to eq('last_7_days') - expect(aggregations.first.measures.first.localized_label).to eq('Logins') + expect(aggregations.first.measures.first.localized_name).to eq('Logins') expect(aggregations.first.measures.first.percentile).to be_nil end end @@ -1964,23 +1966,27 @@ let(:result_with_reporting_aggregation) do { 'data' => { - type: 'reporting/report_aggregation_series', - aggregation_name: 'admin_logins', - visualization: 'bar', - timezone_identifier: 'Europe/Berlin', - buckets: %w[2026-04-01 2026-04-02], - bucket: 'day', - measures: [ + type: 'reporting/report_aggregation_series', + aggregation_name: 'admin_logins', + localized_aggregation_name: 'Admin logins', + visualization: 'bar', + timezone_identifier: 'Europe/Berlin', + buckets: %w[2026-04-01 2026-04-02], + bucket: 'day', + measures: [ { - type: 'reporting/report_aggregation_measure_series', - key: 'login_count', - localized_label: 'Logins', - points: [10, 20], - trend: nil + type: 'reporting/report_aggregation_measure_series', + measure_name: 'login_count', + localized_measure_name: 'Logins', + dimension_name: nil, + localized_dimension_name: nil, + dimension_value: nil, + localized_dimension_value: nil, + points: [10, 20] } ], - partitions_considered: 2, - definition_versions: [1] + partitions_considered: 2, + definition_versions: [1] } } end @@ -2004,9 +2010,10 @@ expect(aggregation_result).to be_a(Ioki::Model::Operator::Reporting::ReportAggregationSeries) expect(aggregation_result.aggregation_name).to eq('admin_logins') + expect(aggregation_result.localized_aggregation_name).to eq('Admin logins') expect(aggregation_result.timezone_identifier).to eq('Europe/Berlin') expect(aggregation_result.bucket).to eq('day') - expect(aggregation_result.measures.first.localized_label).to eq('Logins') + expect(aggregation_result.measures.first.localized_measure_name).to eq('Logins') expect(aggregation_result.partitions_considered).to eq(2) expect(aggregation_result.definition_versions).to eq([1]) end @@ -2029,14 +2036,19 @@ let(:result_with_reporting_aggregation) do { 'data' => { - type: 'reporting/report_aggregation_totals', - aggregation_name: 'admin_logins', - measures: [ + type: 'reporting/report_aggregation_totals', + aggregation_name: 'admin_logins', + localized_aggregation_name: 'Admin logins', + measures: [ { - type: 'reporting/report_aggregation_measure_total', - key: 'login_count', - localized_label: 'Logins', - value: 30.0 + type: 'reporting/report_aggregation_measure_total', + measure_name: 'login_count', + localized_measure_name: 'Logins', + dimension_name: nil, + localized_dimension_name: nil, + dimension_value: nil, + localized_dimension_value: nil, + value: 30.0 } ] } @@ -2062,8 +2074,9 @@ expect(aggregation_totals).to be_a(Ioki::Model::Operator::Reporting::ReportAggregationTotals) expect(aggregation_totals.aggregation_name).to eq('admin_logins') + expect(aggregation_totals.localized_aggregation_name).to eq('Admin logins') expect(aggregation_totals.measures.first).to be_a(Ioki::Model::Operator::Reporting::ReportAggregationMeasureTotal) - expect(aggregation_totals.measures.first.localized_label).to eq('Logins') + expect(aggregation_totals.measures.first.localized_measure_name).to eq('Logins') expect(aggregation_totals.measures.first.value).to eq(30.0) end end