Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/ioki/model/operator/reporting/report_aggregation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class ReportAggregation < Base
on: :read,
type: :string

attribute :localized_name,
on: :read,
type: :string

attribute :visualization,
on: :read,
type: :string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ReportAggregationDimension < Base
on: :read,
type: :string

attribute :localized_label,
attribute :localized_name,
on: :read,
type: :string

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ReportAggregationFilter < Base
on: :read,
type: :string

attribute :localized_label,
attribute :localized_name,
on: :read,
type: :string

Expand Down
12 changes: 6 additions & 6 deletions lib/ioki/model/operator/reporting/report_aggregation_measure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ class ReportAggregationMeasure < Base
on: :read,
type: :string

attribute :localized_name,
on: :read,
type: :string

attribute :function,
on: :read,
type: :string
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
{
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']
}
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_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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
{
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]
}
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_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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading