summaryrefslogtreecommitdiff
path: root/lib/gitlab/cycle_analytics/group_stage_summary.rb
blob: a1fc941495dedc3defe4446fb7fec5be32febfbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

module Gitlab
  module CycleAnalytics
    class GroupStageSummary
      attr_reader :group, :from, :current_user, :options

      def initialize(group, options:)
        @group = group
        @from = options[:from]
        @current_user = options[:current_user]
        @options = options
      end

      def data
        [serialize(Summary::Group::Issue.new(group: group, from: from, current_user: current_user, options: options)),
         serialize(Summary::Group::Deploy.new(group: group, from: from, options: options))]
      end

      private

      def serialize(summary_object)
        AnalyticsSummarySerializer.new.represent(summary_object)
      end
    end
  end
end