Skip to content
Open
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
6 changes: 6 additions & 0 deletions lib/ioki/apis/operator_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,12 @@ class OperatorApi
path: 'aggregations',
model_class: Ioki::Model::Operator::Reporting::ReportAggregation
),
Endpoints::Index.new(
:reporting_dashboards,
base_path: [API_BASE_PATH, 'reporting', 'report', 'scopes', :scope],
path: 'dashboards',
model_class: Ioki::Model::Operator::Reporting::ReportDashboard
),
Endpoints::Create.new(
:reporting_aggregation_series,
base_path: [
Expand Down
28 changes: 28 additions & 0 deletions lib/ioki/model/operator/reporting/report_dashboard.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

module Ioki
module Model
module Operator
module Reporting
class ReportDashboard < Base
attribute :type,
on: :read,
type: :string

attribute :name,
on: :read,
type: :string

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

attribute :groups,
on: :read,
type: :array,
class_name: 'ReportDashboardWidgetGroup'
end
end
end
end
end
71 changes: 71 additions & 0 deletions lib/ioki/model/operator/reporting/report_dashboard_widget.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# frozen_string_literal: true

module Ioki
module Model
module Operator
module Reporting
class ReportDashboardWidget < Base
attribute :type,
on: :read,
type: :string

attribute :name,
on: :read,
type: :string

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

attribute :report_name,
on: :read,
type: :string

attribute :aggregation_name,
on: :read,
type: :string

attribute :localized_aggregation_name,
on: :read,
type: :string

attribute :query_type,
on: :read,
type: :string

attribute :default_preset,
on: :read,
type: :string

attribute :default_bucket,
on: :read,
type: :string

attribute :visualization,
on: :read,
type: :string

attribute :bucket,
on: :read,
type: :object,
class_name: 'ReportAggregationBucket'

attribute :measures,
on: :read,
type: :array,
class_name: 'ReportAggregationMeasure'

attribute :dimensions,
on: :read,
type: :array,
class_name: 'ReportAggregationDimension'

attribute :filters,
on: :read,
type: :array,
class_name: 'ReportAggregationFilter'
end
end
end
end
end
28 changes: 28 additions & 0 deletions lib/ioki/model/operator/reporting/report_dashboard_widget_group.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

module Ioki
module Model
module Operator
module Reporting
class ReportDashboardWidgetGroup < Base
attribute :type,
on: :read,
type: :string

attribute :group_name,
on: :read,
type: :string

attribute :localized_group_name,
on: :read,
type: :string

attribute :widgets,
on: :read,
type: :array,
class_name: 'ReportDashboardWidget'
end
end
end
end
end
14 changes: 14 additions & 0 deletions spec/ioki/operator_api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,20 @@
end
end

describe '#reporting_dashboards(scope)' do
it 'calls request on the client with expected params' do
expect(operator_client).to receive(:request) do |params|
expect(params[:url].to_s)
.to eq('operator/reporting/report/scopes/myscope/dashboards')
result_with_index_data
end

dashboards = operator_client.reporting_dashboards('myscope', options)

expect(dashboards).to all(be_a(Ioki::Model::Operator::Reporting::ReportDashboard))
end
end

describe '#create_reporting_aggregation_series(scope, name, aggregation_name, query)' do
let(:query) do
Ioki::Model::Operator::Reporting::ReportAggregationSeriesQuery.new(
Expand Down